From d267408116d2bee4f9df88f91dbf29bf92d625af Mon Sep 17 00:00:00 2001 From: Joshua McQuistan Date: Sun, 29 Oct 2023 11:58:14 +0000 Subject: [PATCH] Add codec setter to UseStorageOptions --- src/storage/use_storage.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/storage/use_storage.rs b/src/storage/use_storage.rs index 5ee9ab0..7ae49e9 100644 --- a/src/storage/use_storage.rs +++ b/src/storage/use_storage.rs @@ -382,6 +382,14 @@ impl + Default> Default for UseStorageOptions { } impl> UseStorageOptions { + /// Sets the codec to use for encoding and decoding values to and from UTF-16 strings. + pub fn codec(self, codec: impl Into) -> Self { + Self { + codec: codec.into(), + ..self + } + } + /// Optional callback whenever an error occurs. pub fn on_error(self, on_error: impl Fn(UseStorageError) + 'static) -> Self { Self {