Struct gix_filter::eol::Stats
source · pub struct Stats {
pub null: usize,
pub lone_cr: usize,
pub lone_lf: usize,
pub crlf: usize,
pub printable: usize,
pub non_printable: usize,
}
Expand description
Statistics about a buffer that helps to safely perform EOL conversions
Fields§
§null: usize
The amount of null bytes.
lone_cr: usize
The amount of lone carriage returns (\r
).
lone_lf: usize
The amount of lone line feeds (\n
).
crlf: usize
The amount carriage returns followed by line feeds
printable: usize
The estimate of printable characters.
non_printable: usize
The estimate of characters that can’t be printed.
Implementations§
source§impl Stats
impl Stats
sourcepub fn from_bytes(bytes: &[u8]) -> Self
pub fn from_bytes(bytes: &[u8]) -> Self
Gather statistics from the given bytes
.
Note that the entire buffer will be scanned.
sourcepub fn is_binary(&self) -> bool
pub fn is_binary(&self) -> bool
Returns true
if these statistics are typical for a binary file.
sourcepub fn will_convert_lf_to_crlf(
&self,
digest: AttributesDigest,
config: Configuration
) -> bool
pub fn will_convert_lf_to_crlf( &self, digest: AttributesDigest, config: Configuration ) -> bool
Return true
if we would convert the buffer from which these stats are derived, knowing only the digest
Trait Implementations§
source§impl Ord for Stats
impl Ord for Stats
source§impl PartialEq for Stats
impl PartialEq for Stats
source§impl PartialOrd for Stats
impl PartialOrd for Stats
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Stats
impl Eq for Stats
impl StructuralEq for Stats
impl StructuralPartialEq for Stats
Auto Trait Implementations§
impl RefUnwindSafe for Stats
impl Send for Stats
impl Sync for Stats
impl Unpin for Stats
impl UnwindSafe for Stats
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