pub struct SourceBuffer(/* private fields */);Expand description
The common module records and containers. These explicit facade exports
keep ordinary callers out of the component crate paths.
Immutable named bytes retained by a Source.
Implementations§
Source§impl SourceBuffer
impl SourceBuffer
pub fn id(&self) -> &SourceId
pub fn name(&self) -> &str
Sourcepub fn bytes(&self) -> &[u8] ⓘ
pub fn bytes(&self) -> &[u8] ⓘ
The exact retained bytes, including a UTF-8 byte order mark when the input carried one. Same format writing echoes these bytes.
Sourcepub fn has_utf8_bom(&self) -> bool
pub fn has_utf8_bom(&self) -> bool
True when the retained bytes begin with a UTF-8 byte order mark.
Sourcepub fn content_bytes(&self) -> &[u8] ⓘ
pub fn content_bytes(&self) -> &[u8] ⓘ
The bytes a parser decodes: the retained bytes with a leading UTF-8 byte order mark skipped. This is a subslice of the one retained buffer, never a second decoded copy.
Sourcepub fn directory_segments(&self) -> impl Iterator<Item = &str>
pub fn directory_segments(&self) -> impl Iterator<Item = &str>
Directory of this buffer relative to the acquisition root, as path segments. Empty for in-memory buffers and for files sitting directly in the root. A parser that resolves referenced names itself joins these onto the root to seed its resolution base.
Trait Implementations§
Source§impl Clone for SourceBuffer
impl Clone for SourceBuffer
Source§fn clone(&self) -> SourceBuffer
fn clone(&self) -> SourceBuffer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more