pub struct CodecRegistry { /* private fields */ }Expand description
codec dispatch レジストリ。Arc 越しに S4Service / 複数タスクから共有する想定。
Implementations§
Source§impl CodecRegistry
impl CodecRegistry
Sourcepub fn new(default: CodecKind) -> Self
pub fn new(default: CodecKind) -> Self
default で指定した codec が PUT 時の codec として使われる
(dispatcher が別 kind を選んだ場合は、その kind が登録されていれば優先)。
Sourcepub fn register(&mut self, codec: Arc<dyn Codec>) -> &mut Self
pub fn register(&mut self, codec: Arc<dyn Codec>) -> &mut Self
codec を登録。同じ kind を 2 度登録すると後勝ち。
Sourcepub fn default_kind(&self) -> CodecKind
pub fn default_kind(&self) -> CodecKind
default kind
Sourcepub async fn compress(
&self,
input: Bytes,
kind: CodecKind,
) -> Result<(Bytes, ChunkManifest), CodecError>
pub async fn compress( &self, input: Bytes, kind: CodecKind, ) -> Result<(Bytes, ChunkManifest), CodecError>
指定 kind の codec で compress
Sourcepub async fn decompress(
&self,
input: Bytes,
manifest: &ChunkManifest,
) -> Result<Bytes, CodecError>
pub async fn decompress( &self, input: Bytes, manifest: &ChunkManifest, ) -> Result<Bytes, CodecError>
manifest が指す codec で decompress (本命の dispatch path)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CodecRegistry
impl !RefUnwindSafe for CodecRegistry
impl Send for CodecRegistry
impl Sync for CodecRegistry
impl Unpin for CodecRegistry
impl UnsafeUnpin for CodecRegistry
impl !UnwindSafe for CodecRegistry
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