Struct git_repository::config::color::Attribute
pub struct Attribute { /* private fields */ }
Expand description
Discriminating enum for Color
attributes.
git-config
supports modifiers and their negators. The negating color
attributes are equivalent to having a no
or no-
prefix to the normal
variant.
Implementations§
§impl Attribute
impl Attribute
pub const BOLD: Attribute = Self{ bits: 1 << 1,}
pub const DIM: Attribute = Self{ bits: 1 << 2,}
pub const ITALIC: Attribute = Self{ bits: 1 << 3,}
pub const UL: Attribute = Self{ bits: 1 << 4,}
pub const BLINK: Attribute = Self{ bits: 1 << 5,}
pub const REVERSE: Attribute = Self{ bits: 1 << 6,}
pub const STRIKE: Attribute = Self{ bits: 1 << 7,}
pub const RESET: Attribute = Self{ bits: 1 << 8,}
pub const RESET: Attribute = Self{ bits: 1 << 8,}
Reset is special as we have to be able to parse it, without git actually doing anything with it
pub const NO_DIM: Attribute = Self{ bits: 1 << 21,}
pub const NO_BOLD: Attribute = Self{ bits: 1 << 22,}
pub const NO_ITALIC: Attribute = Self{ bits: 1 << 23,}
pub const NO_UL: Attribute = Self{ bits: 1 << 24,}
pub const NO_BLINK: Attribute = Self{ bits: 1 << 25,}
pub const NO_REVERSE: Attribute = Self{ bits: 1 << 26,}
pub const NO_STRIKE: Attribute = Self{ bits: 1 << 27,}
pub const fn from_bits(bits: u32) -> Option<Attribute>
pub const fn from_bits(bits: u32) -> Option<Attribute>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
pub const fn from_bits_truncate(bits: u32) -> Attribute
pub const fn from_bits_truncate(bits: u32) -> Attribute
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
pub const unsafe fn from_bits_unchecked(bits: u32) -> Attribute
pub const unsafe fn from_bits_unchecked(bits: u32) -> Attribute
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Safety
The caller of the bitflags!
macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked()
has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
pub const fn intersects(&self, other: Attribute) -> bool
pub const fn intersects(&self, other: Attribute) -> bool
Returns true
if there are flags common to both self
and other
.
pub const fn contains(&self, other: Attribute) -> bool
pub const fn contains(&self, other: Attribute) -> bool
Returns true
if all of the flags in other
are contained within self
.
pub fn set(&mut self, other: Attribute, value: bool)
pub fn set(&mut self, other: Attribute, value: bool)
Inserts or removes the specified flags depending on the passed value.
pub const fn intersection(self, other: Attribute) -> Attribute
pub const fn intersection(self, other: Attribute) -> Attribute
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
pub const fn union(self, other: Attribute) -> Attribute
pub const fn union(self, other: Attribute) -> Attribute
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both (see Self::symmetric_difference
if that
is undesirable).
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
pub const fn difference(self, other: Attribute) -> Attribute
pub const fn difference(self, other: Attribute) -> Attribute
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
pub const fn symmetric_difference(self, other: Attribute) -> Attribute
pub const fn symmetric_difference(self, other: Attribute) -> Attribute
Returns the symmetric difference between the flags
in self
and other
.
Specifically, the returned set contains the flags present which
are present in self
or other
, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self
and other
.
This is equivalent to using the ^
operator (e.g.
ops::BitXor
), as in flags ^ other
.
pub const fn complement(self) -> Attribute
pub const fn complement(self) -> Attribute
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self
, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all()
and self
(e.g. Self::all() - self
)
This is equivalent to using the !
operator (e.g.
ops::Not
), as in !flags
.
Trait Implementations§
§impl BitAndAssign<Attribute> for Attribute
impl BitAndAssign<Attribute> for Attribute
§fn bitand_assign(&mut self, other: Attribute)
fn bitand_assign(&mut self, other: Attribute)
Disables all flags disabled in the set.
§impl BitOrAssign<Attribute> for Attribute
impl BitOrAssign<Attribute> for Attribute
§fn bitor_assign(&mut self, other: Attribute)
fn bitor_assign(&mut self, other: Attribute)
Adds the set of flags.
§impl BitXorAssign<Attribute> for Attribute
impl BitXorAssign<Attribute> for Attribute
§fn bitxor_assign(&mut self, other: Attribute)
fn bitxor_assign(&mut self, other: Attribute)
Toggles the set of flags.
§impl Extend<Attribute> for Attribute
impl Extend<Attribute> for Attribute
§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = Attribute>,
fn extend<T>(&mut self, iterator: T)where T: IntoIterator<Item = Attribute>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)§impl FromIterator<Attribute> for Attribute
impl FromIterator<Attribute> for Attribute
§impl Ord for Attribute
impl Ord for Attribute
§impl PartialOrd<Attribute> for Attribute
impl PartialOrd<Attribute> for Attribute
§fn partial_cmp(&self, other: &Attribute) -> Option<Ordering>
fn partial_cmp(&self, other: &Attribute) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more§impl SubAssign<Attribute> for Attribute
impl SubAssign<Attribute> for Attribute
§fn sub_assign(&mut self, other: Attribute)
fn sub_assign(&mut self, other: Attribute)
Disables all flags enabled in the set.
impl Copy for Attribute
impl Eq for Attribute
impl StructuralEq for Attribute
impl StructuralPartialEq for Attribute
Auto Trait Implementations§
impl RefUnwindSafe for Attribute
impl Send for Attribute
impl Sync for Attribute
impl Unpin for Attribute
impl UnwindSafe for Attribute
Blanket Implementations§
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere T: Display,
§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
]. Read more