pub struct IdNameMap { /* private fields */ }Expand description
uid → user name and gid → group name, parsed from an image’s account files.
Implementations§
Source§impl IdNameMap
impl IdNameMap
Sourcepub fn from_filesystem(fs: &mut dyn Filesystem) -> Self
pub fn from_filesystem(fs: &mut dyn Filesystem) -> Self
Read /etc/passwd and /etc/group from fs and build the maps. Missing
or unreadable files yield an empty map rather than an error — this is a
display nicety, never a hard dependency.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True when neither file yielded a single entry — the caller should just show raw numbers.
Sourcepub fn format_owner(&self, uid: u32, gid: u32) -> String
pub fn format_owner(&self, uid: u32, gid: u32) -> String
"root:wheel (0:0)" when both names are known, degrading gracefully to
"root:0 (0:0)" or "0:0" as names are missing. Always shows the raw
numbers so nothing is hidden.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IdNameMap
impl RefUnwindSafe for IdNameMap
impl Send for IdNameMap
impl Sync for IdNameMap
impl Unpin for IdNameMap
impl UnsafeUnpin for IdNameMap
impl UnwindSafe for IdNameMap
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