summaryrefslogtreecommitdiff
path: root/deepcrow/src/context.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--deepcrow/src/context.rs (renamed from crimtag/src/context.rs)10
1 files changed, 5 insertions, 5 deletions
diff --git a/crimtag/src/context.rs b/deepcrow/src/context.rs
index a922fd8..4a22cdd 100644
--- a/crimtag/src/context.rs
+++ b/deepcrow/src/context.rs
@@ -1,7 +1,7 @@
1use std::collections::HashMap; 1use std::collections::HashMap;
2use std::fmt; 2use std::fmt;
3 3
4use crate::error::CrimResult; 4use crate::error::Result;
5 5
6use crate::{Identifier,IdentifierValue}; 6use crate::{Identifier,IdentifierValue};
7 7
@@ -19,7 +19,7 @@ impl<'a> MappedStructure<'a> for Context {
19 19
20pub trait MappedList<'a> { 20pub trait MappedList<'a> {
21 fn get_index(&'a self, id: usize) -> Option<MappedValue<'a>>; 21 fn get_index(&'a self, id: usize) -> Option<MappedValue<'a>>;
22 fn for_each(&'a self, func: &dyn Fn(&MappedValue<'a>, &mut String) -> CrimResult<()>) -> CrimResult<String>; 22 fn for_each(&'a self, func: &dyn Fn(&MappedValue<'a>, &mut String) -> Result<()>) -> Result<String>;
23} 23}
24 24
25impl<'a, T: MappedStructure<'a>> MappedList<'a> for Vec<T> { 25impl<'a, T: MappedStructure<'a>> MappedList<'a> for Vec<T> {
@@ -31,7 +31,7 @@ impl<'a, T: MappedStructure<'a>> MappedList<'a> for Vec<T> {
31 } 31 }
32 } 32 }
33 33
34 fn for_each(&'a self, func: &dyn Fn(&MappedValue<'a>, &mut String) -> CrimResult<()>) -> CrimResult<String> { 34 fn for_each(&'a self, func: &dyn Fn(&MappedValue<'a>, &mut String) -> Result<()>) -> Result<String> {
35 let mut buf = String::new(); 35 let mut buf = String::new();
36 for i in self { 36 for i in self {
37 func( &MappedValue::Struct(i), &mut buf )?; 37 func( &MappedValue::Struct(i), &mut buf )?;
@@ -49,7 +49,7 @@ impl<'a> MappedList<'a> for Vec<Value> {
49 } 49 }
50 } 50 }
51 51
52 fn for_each(&'a self, func: &dyn Fn(&MappedValue<'a>, &mut String) -> CrimResult<()>) -> CrimResult<String> { 52 fn for_each(&'a self, func: &dyn Fn(&MappedValue<'a>, &mut String) -> Result<()>) -> Result<String> {
53 let mut buf = String::new(); 53 let mut buf = String::new();
54 for i in self { 54 for i in self {
55 func( &Into::<MappedValue<'a>>::into( i ), &mut buf )?; 55 func( &Into::<MappedValue<'a>>::into( i ), &mut buf )?;
@@ -67,7 +67,7 @@ impl<'a> MappedList<'a> for Vec<MappedValue<'a>> {
67 } 67 }
68 } 68 }
69 69
70 fn for_each(&'a self, func: &dyn Fn(&MappedValue<'a>, &mut String) -> CrimResult<()>) -> CrimResult<String> { 70 fn for_each(&'a self, func: &dyn Fn(&MappedValue<'a>, &mut String) -> Result<()>) -> Result<String> {
71 let mut buf = String::new(); 71 let mut buf = String::new();
72 for i in self { 72 for i in self {
73 func( i, &mut buf )?; 73 func( i, &mut buf )?;