update examples and add documentation

This commit is contained in:
zekro committed 2026-07-17 11:30:08 +02:00
1 parent 9e4e019660
commit e42d897d41
7 files changed
+34 -21

No files matched your search

+6 -6
View File
@@ -11,7 +11,7 @@ struct CredentialManager<State = Locked> {
}
impl CredentialManager {
pub fn new() -> CredentialManager<Locked> {
pub fn new() -> CredentialManager {
CredentialManager {
entries: HashMap::new(),
state: std::marker::PhantomData,
@@ -46,9 +46,9 @@ impl CredentialManager<Unlocked> {
}
fn main() {
let pw = CredentialManager::new();
let mut pw = pw.unlock("pssst");
pw.set("foo", "bar");
let val = pw.get("foo");
pw.lock();
let pw_locked = CredentialManager::new();
let mut pw_unlocked = pw_locked.unlock("pssst");
pw_unlocked.set("foo", "bar");
let val = pw_unlocked.get("foo");
let pw_locked = pw_unlocked.lock();
}