pub enum SysusersEntry {
User {
name: String,
uid: Option<IdSource>,
pgid: Option<GroupReference>,
gecos: String,
home: Option<String>,
shell: Option<String>,
},
Group {
name: String,
id: Option<IdSource>,
},
Range {
start: u32,
end: u32,
},
}Expand description
A parsed sysusers.d entry
Variants§
User
Defines a user
Fields
§
pgid: Option<GroupReference>Group
Defines a group
Range
Defines a range of uids
Implementations§
Source§impl SysusersEntry
impl SysusersEntry
Sourcepub(crate) fn next_token(s: &str) -> Option<(&str, &str)>
pub(crate) fn next_token(s: &str) -> Option<(&str, &str)>
Given an input string, finds the next “token” which is normally delimited by whitespace, but “quoted strings” are also supported. Returns that token and the remainder. If there are no more tokens, this returns None.
Yes this is a lot of manual parsing and there’s a ton of crates we could use, like winnow, but this problem domain is just simple enough that I decided not to learn that yet.
pub(crate) fn next_token_owned(s: &str) -> Option<(String, &str)>
pub(crate) fn next_optional_token(s: &str) -> Option<(Option<&str>, &str)>
pub(crate) fn next_optional_token_owned( s: &str, ) -> Option<(Option<String>, &str)>
pub(crate) fn parse(s: &str) -> Result<Option<SysusersEntry>>
Trait Implementations§
Source§impl Debug for SysusersEntry
impl Debug for SysusersEntry
Source§impl PartialEq for SysusersEntry
impl PartialEq for SysusersEntry
impl Eq for SysusersEntry
impl StructuralPartialEq for SysusersEntry
Auto Trait Implementations§
impl Freeze for SysusersEntry
impl RefUnwindSafe for SysusersEntry
impl Send for SysusersEntry
impl Sync for SysusersEntry
impl Unpin for SysusersEntry
impl UnwindSafe for SysusersEntry
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