Skip to content

Commit

Permalink
tweak with limited depth fn
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch committed Oct 31, 2023
1 parent 6b73764 commit af173b8
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 68 deletions.
8 changes: 4 additions & 4 deletions lib/xdrgen/generators/rust/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
8 changes: 4 additions & 4 deletions spec/output/generator_spec_rust/block_comments.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
8 changes: 4 additions & 4 deletions spec/output/generator_spec_rust/const.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
8 changes: 4 additions & 4 deletions spec/output/generator_spec_rust/enum.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
8 changes: 4 additions & 4 deletions spec/output/generator_spec_rust/nesting.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
8 changes: 4 additions & 4 deletions spec/output/generator_spec_rust/optional.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
8 changes: 4 additions & 4 deletions spec/output/generator_spec_rust/struct.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
8 changes: 4 additions & 4 deletions spec/output/generator_spec_rust/test.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
8 changes: 4 additions & 4 deletions spec/output/generator_spec_rust/union.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ impl<L> Limited<L> {
{
if let Some(depth) = self.limits.depth.checked_sub(1) {
self.limits.depth = depth;
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
} else {
return Err(Error::DepthLimitExceeded);
Err(Error::DepthLimitExceeded)
}
let res = f(self);
self.limits.depth = self.limits.depth.saturating_add(1);
res
}
}

Expand Down

0 comments on commit af173b8

Please sign in to comment.