Struct tantivy::directory::FileSlice [−][src]
Logical slice of read only file in tantivy. It can be cloned and sliced cheaply.
Implementations
impl FileSlice
[src]
pub fn new(file_handle: Box<dyn FileHandle>) -> Self
[src]
Wraps a FileHandle.
pub fn slice(&self, from: usize, to: usize) -> FileSlice
[src]
Creates a fileslice that is just a view over a slice of the data.
Panics
Panics if to < from
or if to
exceeds the filesize.
pub fn empty() -> FileSlice
[src]
Creates an empty FileSlice
pub fn read_bytes(&self) -> Result<OwnedBytes>
[src]
Returns a OwnedBytes
with all of the data in the FileSlice
.
The behavior is strongly dependant on the implementation of the underlying
Directory
and the FileSliceTrait
it creates.
In particular, it is up to the Directory
implementation
to handle caching if needed.
pub fn read_bytes_slice(&self, from: usize, to: usize) -> Result<OwnedBytes>
[src]
Reads a specific slice of data.
This is equivalent to running file_slice.slice(from, to).read_bytes()
.
pub fn split(self, left_len: usize) -> (FileSlice, FileSlice)
[src]
Splits the FileSlice at the given offset and return two file slices.
file_slice[..split_offset]
and file_slice[split_offset..]
.
This operation is cheap and must not copy any underlying data.
pub fn split_from_end(self, right_len: usize) -> (FileSlice, FileSlice)
[src]
Splits the file slice at the given offset and return two file slices.
file_slice[..split_offset]
and file_slice[split_offset..]
.
pub fn slice_from(&self, from_offset: usize) -> FileSlice
[src]
Like .slice(...)
but enforcing only the from
boundary.
Equivalent to .slice(from_offset, self.len())
pub fn slice_to(&self, to_offset: usize) -> FileSlice
[src]
Like .slice(...)
but enforcing only the to
boundary.
Equivalent to .slice(0, to_offset)
Trait Implementations
impl Clone for FileSlice
[src]
impl FileHandle for FileSlice
[src]
fn read_bytes(&self, from: usize, to: usize) -> Result<OwnedBytes>
[src]
impl<B> From<B> for FileSlice where
B: StableDeref + Deref<Target = [u8]> + 'static + Send + Sync,
[src]
B: StableDeref + Deref<Target = [u8]> + 'static + Send + Sync,
impl HasLen for FileSlice
[src]
Auto Trait Implementations
impl !RefUnwindSafe for FileSlice
[src]
impl Send for FileSlice
[src]
impl Sync for FileSlice
[src]
impl Unpin for FileSlice
[src]
impl !UnwindSafe for FileSlice
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
[src]
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T> Fruit for T where
T: Send + Downcast,
[src]
T: Send + Downcast,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,