pub struct MemoryRangeReader { /* private fields */ }Expand description
In-memory range reader for bytes already loaded into memory
This is useful when you have already fetched COG data (e.g., from a cache or network) and want to parse it without writing to disk.
§Example
use cogrs::{CogReader, MemoryRangeReader};
use std::sync::Arc;
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let bytes = std::fs::read("path/to/file.tif")?;
let reader = MemoryRangeReader::new(bytes, "cached://my-layer.tif".to_string());
let cog = CogReader::from_reader(Arc::new(reader))?;
Ok(())
}Implementations§
Source§impl MemoryRangeReader
impl MemoryRangeReader
Trait Implementations§
Source§impl RangeReader for MemoryRangeReader
impl RangeReader for MemoryRangeReader
Auto Trait Implementations§
impl Freeze for MemoryRangeReader
impl RefUnwindSafe for MemoryRangeReader
impl Send for MemoryRangeReader
impl Sync for MemoryRangeReader
impl Unpin for MemoryRangeReader
impl UnwindSafe for MemoryRangeReader
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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