pub fn serialized(&self) -> Result<QueryKey<ByteBuf>, Error> {
        match self {
            Self::Matches(key) => key
                .as_big_endian_bytes()
                .map_err(|err| Error::Database(view::Error::key_serialization(err).to_string()))
                .map(|v| QueryKey::Matches(ByteBuf::from(v.to_vec()))),
            Self::Range(range) => Ok(QueryKey::Range(range.as_big_endian_bytes().map_err(
                |err| Error::Database(view::Error::key_serialization(err).to_string()),
            )?)),
            Self::Multiple(keys) => {
                let keys = keys
                    .iter()
                    .map(|key| {
                        key.as_big_endian_bytes()
                            .map(|key| ByteBuf::from(key.to_vec()))
                            .map_err(|err| {
                                Error::Database(view::Error::key_serialization(err).to_string())
                            })
                    })
                    .collect::<Result<Vec<_>, Error>>()?;

                Ok(QueryKey::Multiple(keys))
            }
        }
    }
/// Converts this key to a serialized format using the [`Key`] trait.
Converts this key to a serialized format using the [`Key`] trait.
Converts this key to a serialized format using the [ ` Key ` ] trait .
pub fn serialized(&self) -> Result<QueryKey<ByteBuf>, Error> {
        match self {
            Self::Matches(key) => key
                .as_big_endian_bytes()
                .map_err(|err| Error::Database(view::Error::key_serialization(err).to_string()))
                .map(|v| QueryKey::Matches(ByteBuf::from(v.to_vec()))),
            Self::Range(range) => Ok(QueryKey::Range(range.as_big_endian_bytes().map_err(
                |err| Error::Database(view::Error::key_serialization(err).to_string()),
            )?)),
            Self::Multiple(keys) => {
                let keys = keys
                    .iter()
                    .map(|key| {
                        key.as_big_endian_bytes()
                            .map(|key| ByteBuf::from(key.to_vec()))
                            .map_err(|err| {
                                Error::Database(view::Error::key_serialization(err).to_string())
                            })
                    })
                    .collect::<Result<Vec<_>, Error>>()?;
                Ok(QueryKey::Multiple(keys))
            }
        }
    }
pub fn serialized ( & self ) -> Result < QueryKey < ByteBuf > , Error > { match self { Self :: Matches ( key ) => key . as_big_endian_bytes ( ) . map_err ( | err | Error :: Database ( view :: Error :: key_serialization ( err ) . to_string ( ) ) ) . map ( | v | QueryKey :: Matches ( ByteBuf :: from ( v . to_vec ( ) ) ) ) , Self :: Range ( range ) => Ok ( QueryKey :: Range ( range . as_big_endian_bytes ( ) . map_err ( | err | Error :: Database ( view :: Error :: key_serialization ( err ) . to_string ( ) ) , ) ? ) ) , Self :: Multiple ( keys ) => { let keys = keys . iter ( ) . map ( | key | { key . as_big_endian_bytes ( ) . map ( | key | ByteBuf :: from ( key . to_vec ( ) ) ) . map_err ( | err | { Error :: Database ( view :: Error :: key_serialization ( err ) . to_string ( ) ) } ) } ) . collect :: < Result < Vec < _ > , Error > > ( ) ? ; Ok ( QueryKey :: Multiple ( keys ) ) } } }
Converts this key to a serialized format using the [`Key`] trait.
Converts this key to a serialized format using the [ ` Key ` ] trait .
&self
&self