diff --git a/v0.5/fastn-section/src/parser/header_value.rs b/v0.5/fastn-section/src/parser/header_value.rs index 8420416f7..5ab2aa8f6 100644 --- a/v0.5/fastn-section/src/parser/header_value.rs +++ b/v0.5/fastn-section/src/parser/header_value.rs @@ -1,4 +1,3 @@ -#[allow(dead_code)] pub fn header_value( scanner: &mut fastn_section::Scanner, ) -> Option { diff --git a/v0.5/fastn-section/src/utils.rs b/v0.5/fastn-section/src/utils.rs index 70b370802..021778e86 100644 --- a/v0.5/fastn-section/src/utils.rs +++ b/v0.5/fastn-section/src/utils.rs @@ -127,9 +127,10 @@ impl fastn_section::Section { source: &'input str, name: &str, ) -> Option<&'input str> { + dbg!(self); self.headers .iter() - .find(|h| h.name(source) == name) + .find(|h| dbg!(h.name(source)) == dbg!(name)) .and_then(|h| h.value.as_plain_string(source)) } } diff --git a/v0.5/fastn-unresolved/src/debug.rs b/v0.5/fastn-unresolved/src/debug.rs index 64eaf858d..2b7db7dde 100644 --- a/v0.5/fastn-unresolved/src/debug.rs +++ b/v0.5/fastn-unresolved/src/debug.rs @@ -17,13 +17,16 @@ impl fastn_section::JDebug for fastn_unresolved::Import { .into(), ); + dbg!(&self); + if let Some(ref v) = self.export { - o.insert("exports".into(), v.debug(source)); + o.insert("export".into(), v.debug(source)); } if let Some(ref v) = self.exposing { o.insert("exposing".into(), v.debug(source)); } + serde_json::Value::Object(o) } } diff --git a/v0.5/fastn-unresolved/src/parser/import.rs b/v0.5/fastn-unresolved/src/parser/import.rs index 28bc62593..add729319 100644 --- a/v0.5/fastn-unresolved/src/parser/import.rs +++ b/v0.5/fastn-unresolved/src/parser/import.rs @@ -89,7 +89,7 @@ fn parse_field( ) -> Option { let header = match section.header_as_plain_string(field, source) { Some(v) => v, - None => return None, + None => return dbg!(None), }; Some(fastn_unresolved::Export::Things( @@ -110,6 +110,7 @@ fn aliasable(s: &str) -> fastn_unresolved::AliasableIdentifier { mod tests { #[track_caller] fn t1(source: &str, expected: serde_json::Value) { + println!("--------- testing -----------\n{source}\n--------- source ------------"); use fastn_section::JDebug; let (mut document, sections) = diff --git a/v0.5/fastn-unresolved/src/utils.rs b/v0.5/fastn-unresolved/src/utils.rs index d5d4cc27c..41b410fb9 100644 --- a/v0.5/fastn-unresolved/src/utils.rs +++ b/v0.5/fastn-unresolved/src/utils.rs @@ -81,8 +81,10 @@ impl From<&str> for fastn_unresolved::Identifier { } } -impl fastn_unresolved::Identifier { - pub fn from_str(s: &str) -> fastn_unresolved::Identifier { - fastn_unresolved::Identifier(s.to_string()) +impl std::str::FromStr for fastn_unresolved::Identifier { + type Err = (); + + fn from_str(s: &str) -> Result { + Ok(fastn_unresolved::Identifier(s.to_string())) } }