Struct wlan_stash::policy::PolicyStorage
source · pub struct PolicyStorage { /* private fields */ }
Expand description
Manages access to the persistent storage or saved network configs through Stash
Implementations§
source§impl PolicyStorage
impl PolicyStorage
sourcepub async fn new_with_id_and_proxy(
id: &str,
proxy_fn: impl FnOnce() -> Result<SecureStoreProxy, Error>
) -> Result<Self, Error>
pub async fn new_with_id_and_proxy( id: &str, proxy_fn: impl FnOnce() -> Result<SecureStoreProxy, Error> ) -> Result<Self, Error>
Initialize new store with the ID provided by the Saved Networks Manager. The ID will
identify stored values as being part of the same persistent storage. proxy_fn
is used to
connect to stash if necessary.
sourcepub async fn new_with_id(id: &str) -> Result<Self, Error>
pub async fn new_with_id(id: &str) -> Result<Self, Error>
Like new_with_id_and_proxy
but provides a default proxy_fn
.
sourcepub fn new_with_stash(proxy: StoreAccessorProxy) -> Self
pub fn new_with_stash(proxy: StoreAccessorProxy) -> Self
Initialize new Stash with a provided proxy in order to mock stash in unit tests.
sourcepub async fn write(
&self,
id: &NetworkIdentifier,
network_configs: &[PersistentData]
) -> Result<(), Error>
pub async fn write( &self, id: &NetworkIdentifier, network_configs: &[PersistentData] ) -> Result<(), Error>
Update the network configs of a given network identifier to persistent storage, deleting the key entirely if the new list of configs is empty.
sourcepub async fn load(
&self
) -> Result<HashMap<NetworkIdentifier, Vec<PersistentData>>, Error>
pub async fn load( &self ) -> Result<HashMap<NetworkIdentifier, Vec<PersistentData>>, Error>
Load all saved network configs from stash. Will create HashMap of network configs by SSID as saved in the stash. If something in stash can’t be interpreted, we ignore it.
Auto Trait Implementations§
impl Freeze for PolicyStorage
impl !RefUnwindSafe for PolicyStorage
impl Send for PolicyStorage
impl Sync for PolicyStorage
impl Unpin for PolicyStorage
impl !UnwindSafe for PolicyStorage
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