pub struct SegmentSource { /* private fields */ }Expand description
A bounded view of a positioned backing, memory buffer, or file.
Clones share the backing, never a seek position. No temporary extraction is needed for a segment stored in a contiguous range of another file.
Implementations§
Source§impl SegmentSource
impl SegmentSource
Sourcepub fn from_backing(backing: Arc<dyn SegmentReadAt>) -> Result<Self>
pub fn from_backing(backing: Arc<dyn SegmentReadAt>) -> Result<Self>
Wraps a caller-provided positioned backend, caching its stable length.
Sourcepub fn from_bytes(bytes: impl Into<Arc<[u8]>>) -> Self
pub fn from_bytes(bytes: impl Into<Arc<[u8]>>) -> Self
Wraps immutable bytes as a segment.
Sourcepub fn from_file(file: File) -> Result<Self>
pub fn from_file(file: File) -> Result<Self>
Wraps a file using native positioned reads on Windows and Unix. Other platforms use a mutex-protected seek/read fallback.
Trait Implementations§
Source§impl Clone for SegmentSource
impl Clone for SegmentSource
Auto Trait Implementations§
impl !RefUnwindSafe for SegmentSource
impl !UnwindSafe for SegmentSource
impl Freeze for SegmentSource
impl Send for SegmentSource
impl Sync for SegmentSource
impl Unpin for SegmentSource
impl UnsafeUnpin for SegmentSource
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more