pub struct CodecSpecificOptions { /* private fields */ }Expand description
Codec-specific options.
This is a type map for codec-specific runtime configuration that is set once and baked into
a codec’s state (e.g. when opening or creating an array).
It is distinct from CodecOptions, which carries per-operation settings passed at each encode/decode call.
Codecs may define their own options type (e.g. ShardingCodecOptions) and retrieve it via get_option.
zarrs_codec itself has no knowledge of any specific codec options type.
§Example
#[derive(Debug, Clone, Default)]
pub struct MyCodecOptions {
pub some_setting: usize,
}
let opts = CodecSpecificOptions::default()
.with_option(MyCodecOptions { some_setting: 16 });
let retrieved = opts.get_option::<MyCodecOptions>().unwrap();
assert_eq!(retrieved.some_setting, 16);Implementations§
Source§impl CodecSpecificOptions
impl CodecSpecificOptions
Sourcepub fn with_option<T: Any + Send + Sync>(self, option: T) -> Self
pub fn with_option<T: Any + Send + Sync>(self, option: T) -> Self
Attach an option for a specific codec, keyed by its type.
If an option of the same type already exists it is replaced.
Trait Implementations§
Source§impl Clone for CodecSpecificOptions
impl Clone for CodecSpecificOptions
Source§fn clone(&self) -> CodecSpecificOptions
fn clone(&self) -> CodecSpecificOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CodecSpecificOptions
impl Debug for CodecSpecificOptions
Source§impl Default for CodecSpecificOptions
impl Default for CodecSpecificOptions
Source§fn default() -> CodecSpecificOptions
fn default() -> CodecSpecificOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CodecSpecificOptions
impl Send for CodecSpecificOptions
impl Sync for CodecSpecificOptions
impl !RefUnwindSafe for CodecSpecificOptions
impl Unpin for CodecSpecificOptions
impl UnsafeUnpin for CodecSpecificOptions
impl !UnwindSafe for CodecSpecificOptions
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