Enum git2::AttrValue [−][src]
pub enum AttrValue<'string> {
True,
False,
String(&'string str),
Bytes(&'string [u8]),
Unspecified,
}Expand description
All possible states of an attribute.
This enum is used to interpret the value returned by
Repository::get_attr and
Repository::get_attr_bytes.
Variants
The attribute is set to true.
The attribute is unset (set to false).
String(&'string str)The attribute is set to a valid UTF-8 string.
Bytes(&'string [u8])The attribute is set to a string that might not be valid UTF-8.
The attribute is not specified.
Implementations
impl<'string> AttrValue<'string>[src]
impl<'string> AttrValue<'string>[src]pub fn from_string(value: Option<&'string str>) -> Self[src]
pub fn from_string(value: Option<&'string str>) -> Self[src]Returns the state of an attribute by inspecting its value by a string.
This function always returns AttrValue::String and never returns AttrValue::Bytes
when the attribute is set to a string.
pub fn from_bytes(value: Option<&'string [u8]>) -> Self[src]
pub fn from_bytes(value: Option<&'string [u8]>) -> Self[src]Returns the state of an attribute by inspecting its value by a byte slice.
This function will perform UTF-8 validation when the attribute is set to a string, returns
AttrValue::String if it’s valid UTF-8 and AttrValue::Bytes otherwise.
pub fn always_bytes(value: Option<&'string [u8]>) -> Self[src]
pub fn always_bytes(value: Option<&'string [u8]>) -> Self[src]Returns the state of an attribute just like AttrValue::from_bytes, but skips UTF-8
validation and always returns AttrValue::Bytes when it’s set to a string.
Trait Implementations
impl PartialEq<AttrValue<'_>> for AttrValue<'_>[src]
impl PartialEq<AttrValue<'_>> for AttrValue<'_>[src]Compare two AttrValues.
Note that this implementation does not differentiate between AttrValue::String and
AttrValue::Bytes.
impl<'string> Copy for AttrValue<'string>[src]
impl<'string> Eq for AttrValue<'string>[src]
impl<'string> StructuralEq for AttrValue<'string>[src]
Auto Trait Implementations
impl<'string> RefUnwindSafe for AttrValue<'string>
impl<'string> Send for AttrValue<'string>
impl<'string> Sync for AttrValue<'string>
impl<'string> Unpin for AttrValue<'string>
impl<'string> UnwindSafe for AttrValue<'string>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more