pub struct EntryMode { /* private fields */ }
Expand description
The mode of items storable in a tree, similar to the file mode on a unix file system.
Used in mutable::Entry
and EntryRef
.
Note that even though it can be created from any u16
, it should be preferable to
create it by converting EntryKind
into EntryMode
.
Implementations§
Source§impl EntryMode
impl EntryMode
Sourcepub const fn value(self) -> u16
pub const fn value(self) -> u16
Expose the value as u16 (lossy, unlike the internal representation that is hidden).
Sourcepub fn as_bytes<'a>(&self, backing: &'a mut [u8; 6]) -> &'a BStr
pub fn as_bytes<'a>(&self, backing: &'a mut [u8; 6]) -> &'a BStr
Return the representation as used in the git internal format, which is octal and written
to the backing
buffer. The respective sub-slice that was written to is returned.
Sourcepub fn from_bytes(i: &[u8]) -> Option<Self>
pub fn from_bytes(i: &[u8]) -> Option<Self>
Construct an EntryMode from bytes represented as in the git internal format.
Source§impl EntryMode
impl EntryMode
Sourcepub const fn kind(&self) -> EntryKind
pub const fn kind(&self) -> EntryKind
Discretize the raw mode into an enum with well-known state while dropping unnecessary details.
Sourcepub const fn is_commit(&self) -> bool
pub const fn is_commit(&self) -> bool
Return true if this entry mode represents the commit of a submodule.
Sourcepub const fn is_no_tree(&self) -> bool
pub const fn is_no_tree(&self) -> bool
Return true if this entry mode represents anything BUT Tree/directory
Sourcepub const fn is_executable(&self) -> bool
pub const fn is_executable(&self) -> bool
Return true if the entry is an executable blob.
Sourcepub const fn is_blob_or_symlink(&self) -> bool
pub const fn is_blob_or_symlink(&self) -> bool
Return true if the entry is any kind of blob or symlink.