pub struct SecretReference { /* private fields */ }Expand description
A parsed 1Password secret reference.
Secret references follow the format op://vault/item/field or
op://vault/item/section/field for section-scoped fields.
§Examples
use corteq_onepassword::SecretReference;
// Parse a simple reference
let reference = SecretReference::parse("op://prod/database/password").unwrap();
assert_eq!(reference.vault(), "prod");
assert_eq!(reference.item(), "database");
assert_eq!(reference.field(), "password");
assert!(reference.section().is_none());
// Parse a section-scoped reference
let reference = SecretReference::parse("op://prod/database/admin/password").unwrap();
assert_eq!(reference.section(), Some("admin"));Implementations§
Source§impl SecretReference
impl SecretReference
Sourcepub fn parse(reference: &str) -> Result<Self>
pub fn parse(reference: &str) -> Result<Self>
Parse a secret reference string.
§Format
op://vault/item/field- Simple referenceop://vault/item/section/field- Section-scoped reference
§Errors
Returns Error::InvalidReference if the reference format is invalid.
§Examples
use corteq_onepassword::SecretReference;
// Valid references
assert!(SecretReference::parse("op://vault/item/field").is_ok());
assert!(SecretReference::parse("op://vault/item/section/field").is_ok());
// Invalid references
assert!(SecretReference::parse("vault/item/field").is_err()); // Missing op://
assert!(SecretReference::parse("op://vault/item").is_err()); // Missing fieldTrait Implementations§
Source§impl AsRef<str> for SecretReference
impl AsRef<str> for SecretReference
Source§impl Clone for SecretReference
impl Clone for SecretReference
Source§fn clone(&self) -> SecretReference
fn clone(&self) -> SecretReference
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SecretReference
impl Debug for SecretReference
Source§impl Display for SecretReference
impl Display for SecretReference
Source§impl Hash for SecretReference
impl Hash for SecretReference
Source§impl PartialEq for SecretReference
impl PartialEq for SecretReference
impl Eq for SecretReference
impl StructuralPartialEq for SecretReference
Auto Trait Implementations§
impl Freeze for SecretReference
impl RefUnwindSafe for SecretReference
impl Send for SecretReference
impl Sync for SecretReference
impl Unpin for SecretReference
impl UnwindSafe for SecretReference
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)