pub struct RawGitMode { /* private fields */ }Expand description
A Git tree-entry mode exactly as written in a source tree.
Git writes a mode as octal digits without leading zeros. Git also reads zero-padded digits and permission bits it would never write. This keeps both: the numeric value plus the count of leading zeros reproduce the source digits exactly.
Implementations§
Source§impl RawGitMode
impl RawGitMode
Sourcepub fn parse(digits: &[u8]) -> Result<RawGitMode, TreeError>
pub fn parse(digits: &[u8]) -> Result<RawGitMode, TreeError>
Parse the octal digits of a tree-entry mode, as they appear before the space in a raw Git tree.
Sourcepub fn canonical(entry_type: EntryType, executable: bool) -> Option<RawGitMode>
pub fn canonical(entry_type: EntryType, executable: bool) -> Option<RawGitMode>
The canonical mode Git writes for an entry of entry_type. None for
a spoollink, which is not a Git object.
Sourcepub fn entry_type(self) -> Option<EntryType>
pub fn entry_type(self) -> Option<EntryType>
The entry kind Git reads this mode as, or None for a mode Heddle
cannot represent. Follows Git’s own reading: only the file-type bits
pick the kind.
Sourcepub fn is_executable(self) -> bool
pub fn is_executable(self) -> bool
Whether Git checks a regular file with this mode out as executable:
the owner execute bit, as in Git’s canon_mode.
Sourcepub fn write_digits(self, out: &mut Vec<u8>)
pub fn write_digits(self, out: &mut Vec<u8>)
Append the exact source digits.
Trait Implementations§
Source§impl Clone for RawGitMode
impl Clone for RawGitMode
Source§fn clone(&self) -> RawGitMode
fn clone(&self) -> RawGitMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more