pub struct OpenFile {
content: Vec<DataId>,
startpoints: ContentStartpoints,
}Expand description
OpenFile stores all information needed to access the contents of a file node
Fields§
§content: Vec<DataId>§startpoints: ContentStartpointsImplementations§
Source§impl OpenFile
impl OpenFile
Sourcepub(crate) fn from_node<S: IndexedFull>(
repo: &Repository<S>,
node: &Node,
) -> RusticResult<Self>
pub(crate) fn from_node<S: IndexedFull>( repo: &Repository<S>, node: &Node, ) -> RusticResult<Self>
Sourcepub fn read_at<S: IndexedFull>(
&self,
repo: &Repository<S>,
offset: usize,
length: usize,
) -> RusticResult<Bytes>
pub fn read_at<S: IndexedFull>( &self, repo: &Repository<S>, offset: usize, length: usize, ) -> RusticResult<Bytes>
Read the OpenFile at the given offset from the repo.
§Arguments
repo- The repository to read theOpenFilefromoffset- The offset to read theOpenFilefromlength- The length of the content to read from theOpenFile
§Errors
- if reading the needed blob(s) from the backend fails
§Returns
The read bytes from the given offset and length.
If offset is behind the end of the file, an empty Bytes is returned.
If length is too large, the result up to the end of the file is returned.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OpenFile
impl RefUnwindSafe for OpenFile
impl Send for OpenFile
impl Sync for OpenFile
impl Unpin for OpenFile
impl UnsafeUnpin for OpenFile
impl UnwindSafe for OpenFile
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> 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