Struct glib::Checksum [−][src]
pub struct Checksum(_);
Expand description
An opaque structure representing a checksumming operation.
To create a new GChecksum, use new()
. To free
a GChecksum, use g_checksum_free()
.
Implementations
Creates a new Checksum
, using the checksum algorithm checksum_type
.
If the checksum_type
is not known, None
is returned.
A Checksum
can be used to compute the checksum, or digest, of an
arbitrary binary blob, using different hashing algorithms.
A Checksum
works by feeding a binary blob through update()
until there is data to be checked; the digest can then be extracted
using string()
, which will return the checksum as a
hexadecimal string; or digest()
, which will return a
vector of raw bytes. Once either string()
or
digest()
have been called on a Checksum
, the checksum
will be closed and it won’t be possible to call update()
on it anymore.
checksum_type
the desired type of checksum
Returns
the newly created Checksum
, or None
.
Use g_checksum_free()
to free the memory allocated by it.
Gets the length in bytes of digests of type checksum_type
checksum_type
Returns
the checksum length, or -1 if checksum_type
is
not supported.
Gets the digest as a hexadecimal string.
Once this function has been called the Checksum
can no longer be
updated with update()
.
The hexadecimal characters will be lower case.
Returns
the hexadecimal representation of the checksum. The returned string is owned by the checksum and should not be modified or freed.
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Returns the type identifier of Self
.
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more
Returns a SendValue
clone of self
.
impl<'a, T, C> FromValueOptional<'a> for T where
C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError>,
T: FromValue<'a, Checker = C>,