pub struct MemoryStorage { /* private fields */ }Expand description
Origin-scoped key/value storage that lives and dies with the process.
Correct, just not durable. It is the right provider for a test, for a private-browsing mode, and for an embedder that has not wired a real one yet, and it is what the storage semantics are asserted against.
Note what it is not: a fallback that silently loses data. chuzz’s
current JavaScript shim is an in-memory localStorage that a page cannot
distinguish from a real one, so a site’s settings vanish on reload with no
diagnostic. That is a property of the shim rather than of in-memory storage,
but an embedder choosing this deliberately should still know it is choosing
it.
Implementations§
Source§impl MemoryStorage
impl MemoryStorage
pub fn new() -> Self
Sourcepub fn origin_count(&self) -> usize
pub fn origin_count(&self) -> usize
How many origins hold anything. For tests that want to assert isolation rather than infer it.
Trait Implementations§
Source§impl Default for MemoryStorage
impl Default for MemoryStorage
Source§fn default() -> MemoryStorage
fn default() -> MemoryStorage
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for MemoryStorage
impl RefUnwindSafe for MemoryStorage
impl Send for MemoryStorage
impl Sync for MemoryStorage
impl Unpin for MemoryStorage
impl UnsafeUnpin for MemoryStorage
impl UnwindSafe for MemoryStorage
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