Skip to content

Commit 8cc8ed1

Browse files
authored
refactor: streamline internal macros for adding nodes (#309)
1 parent 3f85a38 commit 8cc8ed1

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/_macros.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ macro_rules! node_table_add_row_details {
620620
}
621621

622622
macro_rules! node_table_add_row {
623-
($(#[$attr:meta])* => $name: ident, $self: ident, $table: ident $(, $table2: ident )?) => {
623+
($(#[$attr:meta])* => $name: ident, $self: ident, $table: expr) => {
624624
$(#[$attr])*
625625
pub fn $name<F,T,P,I>(
626626
&mut $self,
@@ -641,13 +641,13 @@ macro_rules! node_table_add_row {
641641
individual,
642642
std::ptr::null(),
643643
0,
644-
(*$self.$table)$(.$table2)?)
644+
$table)
645645
}
646646
};
647647
}
648648

649649
macro_rules! node_table_add_row_with_metadata {
650-
($(#[$attr:meta])* => $name: ident, $self: ident, $table: ident $(, $table2: ident )?) => {
650+
($(#[$attr:meta])* => $name: ident, $self: ident, $table: expr) => {
651651
$(#[$attr])*
652652
pub fn $name<F,T,P,I,M>(
653653
&mut $self,
@@ -671,7 +671,7 @@ macro_rules! node_table_add_row_with_metadata {
671671
individual,
672672
md.as_ptr(),
673673
md.len().into(),
674-
(*$self.$table)$(.$table2)?)
674+
$table)
675675
}
676676
};
677677
}

src/node_table.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ build_owned_table_type!(
298298
);
299299

300300
impl OwnedNodeTable {
301-
node_table_add_row!(=> add_row, self, table);
302-
node_table_add_row_with_metadata!(=> add_row_with_metadata, self, table);
301+
node_table_add_row!(=> add_row, self, (*self.table));
302+
node_table_add_row_with_metadata!(=> add_row_with_metadata, self, (*self.table));
303303
}
304304

305305
#[cfg(test)]

src/table_collection.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ impl TableCollection {
364364

365365
node_table_add_row!(
366366
/// Add a row to the node table
367-
=> add_node, self, inner, nodes
367+
=> add_node, self, (*self.inner).nodes
368368
);
369369

370370
node_table_add_row_with_metadata!(
@@ -389,7 +389,7 @@ impl TableCollection {
389389
/// assert!(tables.add_node_with_metadata(0, 0.0, -1, -1, &metadata).is_ok());
390390
/// # }
391391
/// ```
392-
=> add_node_with_metadata, self, inner, nodes);
392+
=> add_node_with_metadata, self, (*self.inner).nodes);
393393

394394
site_table_add_row!(
395395
/// Add a row to the site table

0 commit comments

Comments
 (0)