pub struct WebStorage { /* private fields */ }Expand description
Read/write access to a page’s localStorage or sessionStorage for the
current origin.
Obtained from Page::local_storage
and Page::session_storage.
Implementations§
Source§impl WebStorage
impl WebStorage
Sourcepub async fn get_item(&self, name: &str) -> Result<Option<String>>
pub async fn get_item(&self, name: &str) -> Result<Option<String>>
Returns the value for name, or None if the key is not set.
§Errors
Returns error if:
- The page has been closed
- Communication with the browser process fails
See: https://playwright.dev/docs/api/class-webstorage#web-storage-get-item
Sourcepub async fn set_item(&self, name: &str, value: &str) -> Result<()>
pub async fn set_item(&self, name: &str, value: &str) -> Result<()>
Sets name to value.
§Errors
Returns error if:
- The page has been closed
- Communication with the browser process fails
See: https://playwright.dev/docs/api/class-webstorage#web-storage-set-item
Sourcepub async fn remove_item(&self, name: &str) -> Result<()>
pub async fn remove_item(&self, name: &str) -> Result<()>
Removes name from storage (no-op if absent).
§Errors
Returns error if:
- The page has been closed
- Communication with the browser process fails
See: https://playwright.dev/docs/api/class-webstorage#web-storage-remove-item
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