pub enum GetShared {
Arc(Arc<Box<[u8]>>),
Bytes(Vec<u8>),
}Expand description
Owned GET result for the FFI zero-copy shared lane
(Store::get_shared_owned). Bulk values ride out as an Arc clone (no
byte copy); small values as a plain Vec (one alloc — cheaper than a fresh
Arc). The FFI’s shared free reconstructs whichever the tag says.
use kevy_store::{GetShared, SetCondition, Store};
let mut s = Store::new();
s.set(b"k", b"v".to_vec(), None, SetCondition::Always);
assert!(matches!(s.get_shared_owned(b"k")?, Some(GetShared::Bytes(_))));
assert!(s.get_shared_owned(b"missing")?.is_none());Variants§
Arc(Arc<Box<[u8]>>)
Bulk value — the engine’s Arc, cloned. Zero byte copy.
use kevy_store::{GetShared, SetCondition, Store};
let mut s = Store::new();
s.set(b"big", vec![b'x'; 1024], None, SetCondition::Always);
let Some(GetShared::Arc(a)) = s.get_shared_owned(b"big")? else { panic!() };
assert_eq!(a.len(), 1024);Bytes(Vec<u8>)
Small value (Str/Int) — a plain owned Vec, one allocation.
use kevy_store::{GetShared, SetCondition, Store};
let mut s = Store::new();
s.set(b"n", b"7".to_vec(), None, SetCondition::Always);
let Some(GetShared::Bytes(b)) = s.get_shared_owned(b"n")? else { panic!() };
assert_eq!(b, b"7");Trait Implementations§
Auto Trait Implementations§
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