pub struct IncludeContent { /* private fields */ }Expand description
The content returned by an IncludeFileHandler for an include::
directive, together with the metadata the parser needs to finish processing
the include.
Construct one via IncludeContent::new for UTF-8 content that was read
without interpreting the encoding attribute, or via
IncludeContent::transcoded for content the handler transcoded to UTF-8
while honoring a requested encoding. See the # Encoding section of
IncludeFileHandler::resolve_target for details.
Implementations§
Source§impl IncludeContent
impl IncludeContent
Sourcepub fn new(content: impl Into<String>) -> Self
pub fn new(content: impl Into<String>) -> Self
UTF-8 content that was read without interpreting the encoding
attribute.
If the include:: directive requested a non-UTF-8 encoding, the
parser will emit a non-UTF-8 include-encoding warning. This is the
appropriate constructor for a handler that only deals in UTF-8.
Sourcepub fn transcoded(content: impl Into<String>) -> Self
pub fn transcoded(content: impl Into<String>) -> Self
Content that the handler transcoded to UTF-8 while honoring the
requested encoding attribute.
The parser will not emit a non-UTF-8 include-encoding warning for content returned this way, since the handler has already reencoded it.
Sourcepub fn encoding_handled(&self) -> bool
pub fn encoding_handled(&self) -> bool
Returns true if the handler honored the requested encoding attribute
(i.e. the content was created via IncludeContent::transcoded).
Sourcepub fn into_content(self) -> String
pub fn into_content(self) -> String
Consumes the IncludeContent, returning the owned UTF-8 content.
Trait Implementations§
Source§impl Clone for IncludeContent
impl Clone for IncludeContent
Source§fn clone(&self) -> IncludeContent
fn clone(&self) -> IncludeContent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more