xso: document some specific trait implementations
This commit is contained in:
parent
2ff81b3923
commit
ad2c79cbe7
2 changed files with 10 additions and 0 deletions
|
@ -38,6 +38,8 @@ impl<'x, T: Iterator<Item = Result<Item<'x>, Error>>> Iterator for OptionAsXml<T
|
|||
}
|
||||
}
|
||||
|
||||
/// Emits the contents of `Some(.)` unchanged if present and nothing
|
||||
/// otherwise.
|
||||
impl<T: AsXml> AsXml for Option<T> {
|
||||
type ItemIter<'x> = OptionAsXml<T::ItemIter<'x>> where T: 'x;
|
||||
|
||||
|
@ -60,6 +62,7 @@ impl<'x, T: Iterator<Item = Result<Item<'x>, Error>>> Iterator for BoxAsXml<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Emits the contents of `T` unchanged.
|
||||
impl<T: AsXml> AsXml for Box<T> {
|
||||
type ItemIter<'x> = BoxAsXml<T::ItemIter<'x>> where T: 'x;
|
||||
|
||||
|
|
|
@ -26,6 +26,12 @@ impl<T: FromEventsBuilder> FromEventsBuilder for OptionBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Parsers `T` into `Some(.)`.
|
||||
///
|
||||
/// Note that this never generates `None`: The main use case is to allow
|
||||
/// external (i.e. without calling `from_events`) defaulting to `None` and
|
||||
/// for optional serialisation (the [`AsXml`][`crate::AsXml`] implementation
|
||||
/// on `Option<T>` emits nothing for `None`).
|
||||
impl<T: FromXml> FromXml for Option<T> {
|
||||
type Builder = OptionBuilder<T::Builder>;
|
||||
|
||||
|
@ -48,6 +54,7 @@ impl<T: FromEventsBuilder> FromEventsBuilder for BoxBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Parsers `T` into a `Box`.
|
||||
impl<T: FromXml> FromXml for Box<T> {
|
||||
type Builder = BoxBuilder<T::Builder>;
|
||||
|
||||
|
|
Loading…
Reference in a new issue