pub struct FileMode(/* private fields */);Expand description
A Git file mode (100644, 100755, 120000, 160000, 040000), or
FileMode::ABSENT for the missing side of an add or delete.
Displays and serializes as the six-digit octal text Git prints in raw diff
output, so the zero mode reads 000000.
§Examples
use grit_lib::objects::FileMode;
assert_eq!(FileMode::EXECUTABLE.to_string(), "100755");
assert_eq!(FileMode::ABSENT.to_string(), "000000");
assert_eq!(FileMode::new(0o120000), FileMode::SYMLINK);
assert!(FileMode::SYMLINK.is_symlink());Implementations§
Source§impl FileMode
impl FileMode
Sourcepub const EXECUTABLE: Self
pub const EXECUTABLE: Self
Executable file.
Sourcepub const fn is_absent(self) -> bool
pub const fn is_absent(self) -> bool
Whether this is Self::ABSENT.
Sourcepub fn octal_if_present(self) -> Option<String>
pub fn octal_if_present(self) -> Option<String>
The octal text, or None for Self::ABSENT (the missing side of an add or delete).
Sourcepub const fn is_symlink(self) -> bool
pub const fn is_symlink(self) -> bool
Whether the object-type bits name a symbolic link.
Sourcepub const fn is_gitlink(self) -> bool
pub const fn is_gitlink(self) -> bool
Whether the object-type bits name a gitlink (submodule commit).
Trait Implementations§
impl Copy for FileMode
impl Eq for FileMode
Source§impl Ord for FileMode
impl Ord for FileMode
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for FileMode
impl PartialOrd for FileMode
impl StructuralPartialEq for FileMode
Auto Trait Implementations§
impl Freeze for FileMode
impl RefUnwindSafe for FileMode
impl Send for FileMode
impl Sync for FileMode
impl Unpin for FileMode
impl UnsafeUnpin for FileMode
impl UnwindSafe for FileMode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.