pub enum Key<'a> {
Name(&'a str),
Nth(&'a str, usize),
}Expand description
Addresses a keyword either by name (strict: it must be unique) or by a specific occurrence when a name repeats.
You rarely name Key directly — every keyword accessor takes
impl Into<Key>, so both forms work:
use xisf_header::Header;
let mut h = Header::new();
h.append("HISTORY", "first").unwrap();
h.append("HISTORY", "second").unwrap();
// Bare name is ambiguous here → error; select an occurrence instead.
assert!(h.get_str("HISTORY").is_err());
assert_eq!(h.get_str(("HISTORY", 1)).unwrap(), Some("second"));Variants§
Name(&'a str)
Match the sole keyword with this name (ambiguous if it repeats).
Nth(&'a str, usize)
Match the usize-th (0-based) occurrence of this name.
Implementations§
Trait Implementations§
impl<'a> Copy for Key<'a>
impl<'a> Eq for Key<'a>
impl<'a> StructuralPartialEq for Key<'a>
Auto Trait Implementations§
impl<'a> Freeze for Key<'a>
impl<'a> RefUnwindSafe for Key<'a>
impl<'a> Send for Key<'a>
impl<'a> Sync for Key<'a>
impl<'a> Unpin for Key<'a>
impl<'a> UnsafeUnpin for Key<'a>
impl<'a> UnwindSafe for Key<'a>
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