[−][src]Struct cjdns_bencode::BValue
Generic Bencode value.
Implementations
impl BValue
[src]
pub fn builder() -> BValueBuilder
[src]
Create new BValue
using builder.
pub fn decode(data: &[u8]) -> Result<Self, BdecodeError>
[src]
Create BValue
from bencoded data bytes.
pub fn encode(&self) -> Result<Vec<u8>, BencodeError>
[src]
Encode this BValue
as bencoded data bytes.
pub fn as_int(&self) -> Result<i64, ()>
[src]
Access stored Integer value.
pub fn as_string(&self) -> Result<String, ()>
[src]
Access stored bytes value as UTF-8 string.
pub fn as_bytes(&self) -> Result<Vec<u8>, ()>
[src]
Access stored bytes value.
pub fn has_dict_entry(&self, key: &str) -> bool
[src]
Check whether stored Dict has specified key.
pub fn get_dict_value(&self, key: &str) -> Result<Option<BValue>, ()>
[src]
Access stored Dict value by key and return the data under that key.
pub fn get_dict_value_str(&self, key: &str) -> Result<String, ()>
[src]
Access stored Dict value by key and return the string data under that key. If key does not exist, or associated value is not string, error is returned.
pub fn get_dict_value_bytes(&self, key: &str) -> Result<Vec<u8>, ()>
[src]
Access stored Dict value by key and return the bytes data under that key. If key does not exist, or associated value is not bytes, error is returned.
pub fn delete_dict_value(&mut self, key: &str) -> Result<(), ()>
[src]
pub fn set_dict_value(
&mut self,
key: &'static str,
value: BValue
) -> Result<(), ()>
[src]
&mut self,
key: &'static str,
value: BValue
) -> Result<(), ()>
Trait Implementations
impl Clone for BValue
[src]
impl Debug for BValue
[src]
impl Eq for BValue
[src]
impl PartialEq<BValue> for BValue
[src]
impl StructuralEq for BValue
[src]
impl StructuralPartialEq for BValue
[src]
Auto Trait Implementations
impl RefUnwindSafe for BValue
impl Send for BValue
impl Sync for BValue
impl Unpin for BValue
impl UnwindSafe for BValue
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,