pub struct WebStorage { /* private fields */ }Expand description
A handle to one of a page’s web storages (localStorage or
sessionStorage) for a given origin.
Cheaply cloneable; all clones share the same page session, origin, and storage kind.
Implementations§
Source§impl WebStorage
impl WebStorage
Sourcepub async fn get(&self, key: &str) -> Result<Option<String>>
pub async fn get(&self, key: &str) -> Result<Option<String>>
The value for key, or None if absent.
Sourcepub async fn set(&self, key: &str, value: &str) -> Result<()>
pub async fn set(&self, key: &str, value: &str) -> Result<()>
Set key to value, overwriting any existing value. Issues
DOMStorage.setDOMStorageItem.
Sourcepub async fn remove(&self, key: &str) -> Result<()>
pub async fn remove(&self, key: &str) -> Result<()>
Remove key (no-op if absent). Issues DOMStorage.removeDOMStorageItem.
Sourcepub fn security_origin(&self) -> &str
pub fn security_origin(&self) -> &str
The security origin this storage is scoped to.
Sourcepub fn is_local_storage(&self) -> bool
pub fn is_local_storage(&self) -> bool
true if this is localStorage, false for sessionStorage.
Trait Implementations§
Source§impl Clone for WebStorage
impl Clone for WebStorage
Source§fn clone(&self) -> WebStorage
fn clone(&self) -> WebStorage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for WebStorage
impl !UnwindSafe for WebStorage
impl Freeze for WebStorage
impl Send for WebStorage
impl Sync for WebStorage
impl Unpin for WebStorage
impl UnsafeUnpin for WebStorage
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