-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
127 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
pub(crate) fn get_generic_type(ty: &syn::Type) -> Option<&syn::Type> { | ||
if let syn::Type::Path(syn::TypePath { path, .. }) = ty { | ||
if let Some(seg) = path.segments.last() { | ||
if let syn::PathArguments::AngleBracketed(syn::AngleBracketedGenericArguments { | ||
args, | ||
.. | ||
}) = &seg.arguments | ||
{ | ||
if let Some(syn::GenericArgument::Type(t)) = &args.first() { | ||
return Some(t); | ||
} | ||
} | ||
} | ||
} | ||
None | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use std::io::BufRead; | ||
|
||
use quick_xml::events::BytesStart; | ||
|
||
use crate::{XmlDeserialize, XmlError}; | ||
|
||
// TODO: actually implement | ||
#[derive(Debug, Clone, PartialEq)] | ||
pub struct Unparsed(BytesStart<'static>); | ||
|
||
impl Unparsed { | ||
pub fn tag_name(&self) -> String { | ||
// TODO: respect namespace? | ||
String::from_utf8_lossy(self.0.local_name().as_ref()).to_string() | ||
} | ||
} | ||
|
||
impl XmlDeserialize for Unparsed { | ||
fn deserialize<R: BufRead>( | ||
reader: &mut quick_xml::NsReader<R>, | ||
start: &BytesStart, | ||
empty: bool, | ||
) -> Result<Self, XmlError> { | ||
// let reader_cloned = NsReader::from_reader(reader.get_ref().to_owned()); | ||
if !empty { | ||
let mut buf = vec![]; | ||
reader.read_to_end_into(start.name(), &mut buf)?; | ||
} | ||
Ok(Self(start.to_owned())) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters