diff options
| author | Mike Buland <mike@xagasoft.com> | 2026-06-13 09:26:56 -0700 |
|---|---|---|
| committer | Mike Buland <mike@xagasoft.com> | 2026-06-13 09:26:56 -0700 |
| commit | 038884232b6efbabb414cb011fa0fc4e3b4c8fd6 (patch) | |
| tree | f960400d8733c50eb13d9a04986ed6e896d50542 /src/context.rs | |
| parent | 6188fa4c32160846908e4ff7654c4ff7bc177797 (diff) | |
| download | crimtag-038884232b6efbabb414cb011fa0fc4e3b4c8fd6.tar.gz crimtag-038884232b6efbabb414cb011fa0fc4e3b4c8fd6.tar.bz2 crimtag-038884232b6efbabb414cb011fa0fc4e3b4c8fd6.tar.xz crimtag-038884232b6efbabb414cb011fa0fc4e3b4c8fd6.zip | |
I did some silly things. This one doesn't build.
Diffstat (limited to 'src/context.rs')
| -rw-r--r-- | src/context.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/context.rs b/src/context.rs index 7484a1f..d322411 100644 --- a/src/context.rs +++ b/src/context.rs | |||
| @@ -39,21 +39,27 @@ impl MappedStructure for Context { | |||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | pub struct StatefulContext<'a, T: MappedStructure> { | 41 | pub struct StatefulContext<'a, T: MappedStructure> { |
| 42 | root: &'a T, | 42 | pub root: &'a T, |
| 43 | current: &'a T, | 43 | local: &'a T, |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | impl<'a, T: MappedStructure> StatefulContext<'a, T> { | 46 | impl<'a, T: MappedStructure> StatefulContext<'a, T> { |
| 47 | pub fn root( root: &'a T ) -> Self { | 47 | pub fn root( root: &'a T ) -> Self { |
| 48 | Self { | 48 | Self { |
| 49 | root, current: root, | 49 | root, local: root, |
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | pub fn local(&self, current: &'a T ) -> Self { | 53 | pub fn local(&self, local: &'a T ) -> Self { |
| 54 | Self { | 54 | Self { |
| 55 | root: self.root, | 55 | root: self.root, |
| 56 | current | 56 | local |
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | pub fn full( root: &'a T, local: &'a T ) -> Self { | ||
| 61 | Self { | ||
| 62 | root, local | ||
| 57 | } | 63 | } |
| 58 | } | 64 | } |
| 59 | } | 65 | } |
| @@ -66,7 +72,7 @@ impl<'a, T: MappedStructure> MappedStructure for StatefulContext<'a,T> { | |||
| 66 | if id[0] == IdentifierValue::Root { | 72 | if id[0] == IdentifierValue::Root { |
| 67 | self.root.get_value( &id[1..] ) | 73 | self.root.get_value( &id[1..] ) |
| 68 | } else { | 74 | } else { |
| 69 | self.current.get_value( id ) | 75 | self.local.get_value( id ) |
| 70 | } | 76 | } |
| 71 | } | 77 | } |
| 72 | } | 78 | } |
