pub struct GroupRef<G: Group> { /* private fields */ }Expand description
A reference to one section of the named group G, by the name of the
section.
The value of a key that names another group has this type.
RepoConfig::resolve gives the section. The text form is the name of
the section, which is not empty.
§Examples
use ostrya_core::config::GroupRef;
ostrya_core::config_group! {
pub group image = named "ex-image" {
Arch: Option<String> = "arch";
}
}
let base = GroupRef::<image::Group>::new("base").unwrap();
assert_eq!(base.name(), "base");
assert!(GroupRef::<image::Group>::new("").is_err());Implementations§
Source§impl<G: Group> GroupRef<G>
impl<G: Group> GroupRef<G>
Sourcepub fn new(name: impl Into<String>) -> Result<GroupRef<G>, ValueError>
pub fn new(name: impl Into<String>) -> Result<GroupRef<G>, ValueError>
Returns a reference to the section name.
§Errors
A ValueError with the text is empty if name is empty.
Value::parse gives the same error for an empty name.
Trait Implementations§
impl<G: Group> Eq for GroupRef<G>
Auto Trait Implementations§
impl<G> Forget for GroupRef<G>
impl<G> Freeze for GroupRef<G>
impl<G> Move for GroupRef<G>
impl<G> RefUnwindSafe for GroupRef<G>
impl<G> Send for GroupRef<G>where
RawVecInner: Send,
impl<G> Sync for GroupRef<G>where
RawVecInner: Sync,
impl<G> Unpin for GroupRef<G>
impl<G> UnsafeUnpin for GroupRef<G>where
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<fn() -> G>: UnsafeUnpin,
impl<G> UnwindSafe for GroupRef<G>where
RawVecInner: UnwindSafe,
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