-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #784 from bokuweb/cacthup-main
catch up main
- Loading branch information
Showing
280 changed files
with
12,004 additions
and
11,437 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,38 @@ | ||
use crate::xml_builder::XMLBuilder; | ||
use std::io::Write; | ||
|
||
pub trait BuildXML { | ||
fn build(&self) -> Vec<u8>; | ||
/// Write XML to the output stream. | ||
#[doc(hidden)] | ||
fn build_to<W: Write>( | ||
&self, | ||
stream: xml::writer::EventWriter<W>, | ||
) -> xml::writer::Result<xml::writer::EventWriter<W>>; | ||
|
||
#[doc(hidden)] | ||
fn build(&self) -> Vec<u8> { | ||
self.build_to(XMLBuilder::new(Vec::new()).into_inner().unwrap()) | ||
.expect("should write to buf") | ||
.into_inner() | ||
} | ||
} | ||
|
||
impl<'a, T: BuildXML> BuildXML for &'a T { | ||
/// Building XML from `&T` is the same as from `T`. | ||
fn build_to<W: Write>( | ||
&self, | ||
stream: xml::writer::EventWriter<W>, | ||
) -> xml::writer::Result<xml::writer::EventWriter<W>> { | ||
(*self).build_to(stream) | ||
} | ||
} | ||
|
||
impl<T: BuildXML> BuildXML for Box<T> { | ||
/// Building XML from `Box<T>` is the same as from `T`. | ||
fn build_to<W: Write>( | ||
&self, | ||
stream: xml::writer::EventWriter<W>, | ||
) -> xml::writer::Result<xml::writer::EventWriter<W>> { | ||
(**self).build_to(stream) | ||
} | ||
} |
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
Oops, something went wrong.