pub struct SourceBuffer(/* private fields */);Expand description
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
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SourceBuffer
impl RefUnwindSafe for SourceBuffer
impl Send for SourceBuffer
impl Sync for SourceBuffer
impl Unpin for SourceBuffer
impl UnsafeUnpin for SourceBuffer
impl UnwindSafe for SourceBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more