Doc improvements and minor cleanups (#281)

This commit is contained in:
Tony Arcieri (iqlusion)
2021-07-12 11:57:42 -07:00
committed by GitHub
parent 47776ebf0b
commit 5f418bbd1d
8 changed files with 20 additions and 12 deletions
+3
View File
@@ -88,6 +88,7 @@ impl<T: MetadataType> Metadata<T> {
/// Write metadata
#[cfg(feature = "untested")]
#[cfg_attr(docsrs, doc(cfg(feature = "untested")))]
pub(crate) fn write(&self, txn: &Transaction<'_>) -> Result<()> {
if self.inner.len() > CB_OBJ_MAX - CB_OBJ_TAG_MAX {
return Err(Error::GenericError);
@@ -105,6 +106,7 @@ impl<T: MetadataType> Metadata<T> {
/// Delete metadata
#[cfg(feature = "untested")]
#[cfg_attr(docsrs, doc(cfg(feature = "untested")))]
pub(crate) fn delete(txn: &Transaction<'_>) -> Result<()> {
txn.save_object(T::obj_id(), &[])
}
@@ -128,6 +130,7 @@ impl<T: MetadataType> Metadata<T> {
/// Set metadata item
#[cfg(feature = "untested")]
#[cfg_attr(docsrs, doc(cfg(feature = "untested")))]
pub(crate) fn set_item(&mut self, tag: u8, item: &[u8]) -> Result<()> {
let mut cb_temp: usize = 0;
let mut tag_temp: u8 = 0;