diff --git a/cbor_smol/de/fn.from_bytes.html b/cbor_smol/de/fn.from_bytes.html index c52ae45..e0ca2d4 100644 --- a/cbor_smol/de/fn.from_bytes.html +++ b/cbor_smol/de/fn.from_bytes.html @@ -1,4 +1,4 @@ from_bytes in cbor_smol::de - Rust

Function cbor_smol::de::from_bytes

source ·
pub fn from_bytes<'a, T>(s: &'a [u8]) -> Result<T>
where - T: Deserialize<'a>,
Expand description

Deserialize a message of type T from a byte slice. The unused portion (if any) + T: Deserialize<'a>,

Expand description

Deserialize a message of type T from a byte slice. The unused portion (if any) of the byte slice is returned for further usage

\ No newline at end of file diff --git a/cbor_smol/de/fn.take_from_bytes.html b/cbor_smol/de/fn.take_from_bytes.html index dc751ee..9acb78e 100644 --- a/cbor_smol/de/fn.take_from_bytes.html +++ b/cbor_smol/de/fn.take_from_bytes.html @@ -1,4 +1,4 @@ take_from_bytes in cbor_smol::de - Rust

Function cbor_smol::de::take_from_bytes

source ·
pub fn take_from_bytes<'a, T>(s: &'a [u8]) -> Result<(T, &'a [u8])>
where - T: Deserialize<'a>,
Expand description

Deserialize a message of type T from a byte slice. The unused portion (if any) + T: Deserialize<'a>,

Expand description

Deserialize a message of type T from a byte slice. The unused portion (if any) of the byte slice is returned for further usage

\ No newline at end of file diff --git a/cbor_smol/de/struct.Deserializer.html b/cbor_smol/de/struct.Deserializer.html index e271569..81c60b2 100644 --- a/cbor_smol/de/struct.Deserializer.html +++ b/cbor_smol/de/struct.Deserializer.html @@ -1,85 +1,85 @@ Deserializer in cbor_smol::de - Rust

Struct cbor_smol::de::Deserializer

source ·
pub struct Deserializer<'de> { /* private fields */ }
Expand description

A structure for deserializing a cbor-smol message.

Implementations§

source§

impl<'de> Deserializer<'de>

source

pub fn from_bytes(input: &'de [u8]) -> Self

Obtain a Deserializer from a slice of bytes

-

Trait Implementations§

source§

impl<'de, 'a> Deserializer<'de> for &'a mut Deserializer<'de>

§

type Error = Error

The error type that can be returned if some error occurs during -deserialization.
source§

fn deserialize_any<V>(self, _visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Require the Deserializer to figure out how to drive the visitor based -on what data type is in the input. Read more
source§

fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a bool value.
source§

fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting an i8 value.
source§

fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting an i16 value.
source§

fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting an i32 value.
source§

fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting an i64 value.
source§

fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a u8 value.
source§

fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a u16 value.
source§

fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a u32 value.
source§

fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a u64 value.
source§

fn deserialize_f32<V>(self, _visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a f32 value.
source§

fn deserialize_f64<V>(self, _visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a f64 value.
source§

fn deserialize_char<V>(self, _visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a char value.
source§

fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and does not +

Trait Implementations§

source§

impl<'de, 'a> Deserializer<'de> for &'a mut Deserializer<'de>

§

type Error = Error

The error type that can be returned if some error occurs during +deserialization.
source§

fn deserialize_any<V>(self, _visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Require the Deserializer to figure out how to drive the visitor based +on what data type is in the input. Read more
source§

fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a bool value.
source§

fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting an i8 value.
source§

fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting an i16 value.
source§

fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting an i32 value.
source§

fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting an i64 value.
source§

fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a u8 value.
source§

fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a u16 value.
source§

fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a u32 value.
source§

fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a u64 value.
source§

fn deserialize_f32<V>(self, _visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a f32 value.
source§

fn deserialize_f64<V>(self, _visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a f64 value.
source§

fn deserialize_char<V>(self, _visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a char value.
source§

fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and does not benefit from taking ownership of buffered data owned by the -Deserializer. Read more
source§

fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and would +Deserializer. Read more
source§

fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and would benefit from taking ownership of buffered data owned by the -Deserializer. Read more
source§

fn deserialize_str<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and does +Deserializer. Read more
source§

fn deserialize_str<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and does not benefit from taking ownership of buffered data owned by the -Deserializer. Read more
source§

fn deserialize_string<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and would +Deserializer. Read more
source§

fn deserialize_string<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and would benefit from taking ownership of buffered data owned by the -Deserializer. Read more
source§

fn deserialize_option<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting an optional value. Read more
source§

fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit value.
source§

fn deserialize_unit_struct<V>( +Deserializer. Read more

source§

fn deserialize_option<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting an optional value. Read more
source§

fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit value.
source§

fn deserialize_unit_struct<V>( self, _name: &'static str, visitor: V, -) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit struct with a -particular name.
source§

fn deserialize_newtype_struct<V>( +) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit struct with a +particular name.
source§

fn deserialize_newtype_struct<V>( self, _name: &'static str, visitor: V, -) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a newtype struct with a -particular name.
source§

fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values.
source§

fn deserialize_tuple<V>(self, _len: usize, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values and -knows how many values there are without looking at the serialized data.
source§

fn deserialize_tuple_struct<V>( +) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a newtype struct with a +particular name.
source§

fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values.
source§

fn deserialize_tuple<V>(self, _len: usize, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values and +knows how many values there are without looking at the serialized data.
source§

fn deserialize_tuple_struct<V>( self, _name: &'static str, len: usize, visitor: V, -) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a tuple struct with a -particular name and number of fields.
source§

fn deserialize_map<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a map of key-value pairs.
source§

fn deserialize_struct<V>( +) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a tuple struct with a +particular name and number of fields.
source§

fn deserialize_map<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a map of key-value pairs.
source§

fn deserialize_struct<V>( self, _name: &'static str, _fields: &'static [&'static str], visitor: V, -) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting a struct with a particular -name and fields.
source§

fn deserialize_enum<V>( +) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting a struct with a particular +name and fields.
source§

fn deserialize_enum<V>( self, _name: &'static str, _variants: &'static [&'static str], visitor: V, -) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting an enum value with a -particular name and possible variants.
source§

fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting the name of a struct -field or the discriminant of an enum variant.
source§

fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value>
where - V: Visitor<'de>,

Hint that the Deserialize type needs to deserialize a value whose type -doesn’t matter because it is ignored. Read more
source§

fn deserialize_i128<V>( +) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting an enum value with a +particular name and possible variants.
source§

fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting the name of a struct +field or the discriminant of an enum variant.
source§

fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value>
where + V: Visitor<'de>,

Hint that the Deserialize type needs to deserialize a value whose type +doesn’t matter because it is ignored. Read more
source§

fn deserialize_i128<V>( self, visitor: V, -) -> Result<<V as Visitor<'de>>::Value, Self::Error>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting an i128 value. Read more
source§

fn deserialize_u128<V>( +) -> Result<<V as Visitor<'de>>::Value, Self::Error>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting an i128 value. Read more
source§

fn deserialize_u128<V>( self, visitor: V, -) -> Result<<V as Visitor<'de>>::Value, Self::Error>
where - V: Visitor<'de>,

Hint that the Deserialize type is expecting an u128 value. Read more
source§

fn is_human_readable(&self) -> bool

Determine whether Deserialize implementations should expect to -deserialize their human-readable form. Read more

Auto Trait Implementations§

§

impl<'de> Freeze for Deserializer<'de>

§

impl<'de> RefUnwindSafe for Deserializer<'de>

§

impl<'de> Send for Deserializer<'de>

§

impl<'de> Sync for Deserializer<'de>

§

impl<'de> Unpin for Deserializer<'de>

§

impl<'de> UnwindSafe for Deserializer<'de>

Blanket Implementations§

source§

impl<T> Any for T
where +) -> Result<<V as Visitor<'de>>::Value, Self::Error>
where + V: Visitor<'de>,

Hint that the Deserialize type is expecting an u128 value. Read more
source§

fn is_human_readable(&self) -> bool

Determine whether Deserialize implementations should expect to +deserialize their human-readable form. Read more

Auto Trait Implementations§

§

impl<'de> Freeze for Deserializer<'de>

§

impl<'de> RefUnwindSafe for Deserializer<'de>

§

impl<'de> Send for Deserializer<'de>

§

impl<'de> Sync for Deserializer<'de>

§

impl<'de> Unpin for Deserializer<'de>

§

impl<'de> UnwindSafe for Deserializer<'de>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/cbor_smol/error/enum.Error.html b/cbor_smol/error/enum.Error.html index 406ff43..56cdaae 100644 --- a/cbor_smol/error/enum.Error.html +++ b/cbor_smol/error/enum.Error.html @@ -1,61 +1,61 @@ Error in cbor_smol::error - Rust

Enum cbor_smol::error::Error

source ·
#[non_exhaustive]
#[repr(u8)]
pub enum Error { -
Show 22 variants WontImplement, - NotYetImplemented, - SerializeBufferFull(usize), - DeserializeUnexpectedEnd, - DeserializeBadBool, - DeserializeBadUtf8, - DeserializeBadEnum, - DeserializeBadMajor, - DeserializeBadI8, - DeserializeBadI16, - DeserializeBadI32, - DeserializeBadI64, - DeserializeBadU8, - DeserializeBadU16, - DeserializeBadU32, - DeserializeBadU64, - DeserializeExpectedNull, - InexistentSliceToArrayError, - DeserializeNonMinimal, - SerdeSerCustom, - SerdeDeCustom, - SerdeMissingField, +
Show 22 variants WontImplement = 0, + NotYetImplemented = 1, + SerializeBufferFull = 2, + DeserializeUnexpectedEnd = 3, + DeserializeBadBool = 4, + DeserializeBadUtf8 = 5, + DeserializeBadEnum = 6, + DeserializeBadMajor = 7, + DeserializeBadI8 = 8, + DeserializeBadI16 = 9, + DeserializeBadI32 = 10, + DeserializeBadI64 = 11, + DeserializeBadU8 = 12, + DeserializeBadU16 = 13, + DeserializeBadU32 = 14, + DeserializeBadU64 = 15, + DeserializeExpectedNull = 16, + InexistentSliceToArrayError = 17, + DeserializeNonMinimal = 18, + SerdeSerCustom = 19, + SerdeDeCustom = 20, + SerdeMissingField = 21,
}
Expand description

This is the error type used by cbor-smol

-

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

WontImplement

This is a feature that cbor-smol will never implement

-
§

NotYetImplemented

This is a feature that cbor-smol intends to support, but does not yet

-
§

SerializeBufferFull(usize)

The serialize buffer is full

-
§

DeserializeUnexpectedEnd

Hit the end of buffer, expected more data

-
§

DeserializeBadBool

Found a bool that wasn’t 0xf4 or 0xf5

-
§

DeserializeBadUtf8

Tried to parse invalid utf-8

-
§

DeserializeBadEnum

Could not parse an enum

-
§

DeserializeBadMajor

Expected a different major type

-
§

DeserializeBadI8

Expected a i8, was too large

-
§

DeserializeBadI16

Expected a i16, was too large

-
§

DeserializeBadI32

Expected a i32, was too large

-
§

DeserializeBadI64

Expected a i64, was too large

-
§

DeserializeBadU8

Expected a u8

-
§

DeserializeBadU16

Expected a u16

-
§

DeserializeBadU32

Expected a u32

-
§

DeserializeBadU64

Expected a u64

-
§

DeserializeExpectedNull

Expected a NULL marker

-
§

InexistentSliceToArrayError

Inexistent slice-to-array cast error. Used here to avoid calling unwrap.

-
§

DeserializeNonMinimal

Value may be valid, but not encoded in minimal way

-
§

SerdeSerCustom

Serde Serialization Error

-
§

SerdeDeCustom

Serde Deserialization Error

-
§

SerdeMissingField

Serde Missing required value

-

Trait Implementations§

source§

impl Clone for Error

source§

fn clone(&self) -> Error

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Error

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Error

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Error for Error

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl Error for Error

source§

fn custom<T>(_msg: T) -> Self
where - T: Display,

Used when a Serialize implementation encounters any error -while serializing a type. Read more
source§

impl Error for Error

source§

fn custom<T>(msg: T) -> Self
where - T: Display,

Raised when there is general error when deserializing a type. Read more
source§

fn missing_field(field: &'static str) -> Self

Raised when a Deserialize struct type expected to receive a required +

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

WontImplement = 0

This is a feature that cbor-smol will never implement

+
§

NotYetImplemented = 1

This is a feature that cbor-smol intends to support, but does not yet

+
§

SerializeBufferFull = 2

The serialize buffer is full

+
§

DeserializeUnexpectedEnd = 3

Hit the end of buffer, expected more data

+
§

DeserializeBadBool = 4

Found a bool that wasn’t 0xf4 or 0xf5

+
§

DeserializeBadUtf8 = 5

Tried to parse invalid utf-8

+
§

DeserializeBadEnum = 6

Could not parse an enum

+
§

DeserializeBadMajor = 7

Expected a different major type

+
§

DeserializeBadI8 = 8

Expected a i8, was too large

+
§

DeserializeBadI16 = 9

Expected a i16, was too large

+
§

DeserializeBadI32 = 10

Expected a i32, was too large

+
§

DeserializeBadI64 = 11

Expected a i64, was too large

+
§

DeserializeBadU8 = 12

Expected a u8

+
§

DeserializeBadU16 = 13

Expected a u16

+
§

DeserializeBadU32 = 14

Expected a u32

+
§

DeserializeBadU64 = 15

Expected a u64

+
§

DeserializeExpectedNull = 16

Expected a NULL marker

+
§

InexistentSliceToArrayError = 17

Inexistent slice-to-array cast error. Used here to avoid calling unwrap.

+
§

DeserializeNonMinimal = 18

Value may be valid, but not encoded in minimal way

+
§

SerdeSerCustom = 19

Serde Serialization Error

+
§

SerdeDeCustom = 20

Serde Deserialization Error

+
§

SerdeMissingField = 21

Serde Missing required value

+

Trait Implementations§

source§

impl Clone for Error

source§

fn clone(&self) -> Error

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Error

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Error

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Error for Error

source§

fn custom<T>(msg: T) -> Self
where + T: Display,

Raised when there is general error when deserializing a type. Read more
source§

fn missing_field(field: &'static str) -> Self

Raised when a Deserialize struct type expected to receive a required field with a particular name but that field was not present in the -input.
source§

fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a type different from what it was -expecting. Read more
source§

fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a value of the right type but that -is wrong for some other reason. Read more
source§

fn invalid_length(len: usize, exp: &dyn Expected) -> Self

Raised when deserializing a sequence or map and the input data contains -too many or too few elements. Read more
source§

fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize enum type received a variant with an -unrecognized name.
source§

fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize struct type received a field with an -unrecognized name.
source§

fn duplicate_field(field: &'static str) -> Self

Raised when a Deserialize struct type received more than one of the -same field.
source§

impl PartialEq for Error

source§

fn eq(&self, other: &Error) -> bool

This method tests for self and other values to be equal, and is used +input.
source§

fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a type different from what it was +expecting. Read more
source§

fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a value of the right type but that +is wrong for some other reason. Read more
source§

fn invalid_length(len: usize, exp: &dyn Expected) -> Self

Raised when deserializing a sequence or map and the input data contains +too many or too few elements. Read more
source§

fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize enum type received a variant with an +unrecognized name.
source§

fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize struct type received a field with an +unrecognized name.
source§

fn duplicate_field(field: &'static str) -> Self

Raised when a Deserialize struct type received more than one of the +same field.
source§

impl Error for Error

source§

fn custom<T>(_msg: T) -> Self
where + T: Display,

Used when a Serialize implementation encounters any error +while serializing a type. Read more
source§

impl Error for Error

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl PartialEq for Error

source§

fn eq(&self, other: &Error) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Error

source§

impl Eq for Error

source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where diff --git a/cbor_smol/fn.cbor_deserialize.html b/cbor_smol/fn.cbor_deserialize.html index 6229831..f790673 100644 --- a/cbor_smol/fn.cbor_deserialize.html +++ b/cbor_smol/fn.cbor_deserialize.html @@ -1,3 +1,3 @@ -cbor_deserialize in cbor_smol - Rust

Function cbor_smol::cbor_deserialize

source ·
pub fn cbor_deserialize<'de, T: Deserialize<'de>>(
+cbor_deserialize in cbor_smol - Rust

Function cbor_smol::cbor_deserialize

source ·
pub fn cbor_deserialize<'de, T: Deserialize<'de>>(
     buffer: &'de [u8],
 ) -> Result<T>
\ No newline at end of file diff --git a/cbor_smol/fn.cbor_serialize.html b/cbor_smol/fn.cbor_serialize.html index 3f1e8df..a94bcf0 100644 --- a/cbor_smol/fn.cbor_serialize.html +++ b/cbor_smol/fn.cbor_serialize.html @@ -1,4 +1,4 @@ -cbor_serialize in cbor_smol - Rust

Function cbor_smol::cbor_serialize

source ·
pub fn cbor_serialize<'a, T: ?Sized + Serialize>(
+cbor_serialize in cbor_smol - Rust

Function cbor_smol::cbor_serialize

source ·
pub fn cbor_serialize<'a, T: ?Sized + Serialize>(
     object: &T,
     buffer: &'a mut [u8],
 ) -> Result<&'a [u8]>
\ No newline at end of file diff --git a/cbor_smol/fn.cbor_serialize_to.html b/cbor_smol/fn.cbor_serialize_to.html index f60d6be..7355140 100644 --- a/cbor_smol/fn.cbor_serialize_to.html +++ b/cbor_smol/fn.cbor_serialize_to.html @@ -1,4 +1,4 @@ -cbor_serialize_to in cbor_smol - Rust

Function cbor_smol::cbor_serialize_to

source ·
pub fn cbor_serialize_to<T: ?Sized + Serialize, W: Writer>(
+cbor_serialize_to in cbor_smol - Rust

Function cbor_smol::cbor_serialize_to

source ·
pub fn cbor_serialize_to<T: ?Sized + Serialize, W: Writer>(
     object: &T,
     writer: W,
 ) -> Result<usize>
Expand description

Serialize an object to a Writer

diff --git a/cbor_smol/ser/struct.Serializer.html b/cbor_smol/ser/struct.Serializer.html index 5c88896..ff8d9aa 100644 --- a/cbor_smol/ser/struct.Serializer.html +++ b/cbor_smol/ser/struct.Serializer.html @@ -1,91 +1,91 @@ Serializer in cbor_smol::ser - Rust

Struct cbor_smol::ser::Serializer

source ·
pub struct Serializer<W> { /* private fields */ }

Implementations§

source§

impl<W: Writer> Serializer<W>

source

pub fn new(writer: W) -> Self

source

pub fn written(&self) -> usize

source

pub fn into_inner(self) -> W

Unwrap the Writer from the Serializer.

-

Trait Implementations§

source§

impl<'a, W> SerializeStruct for &'a mut Serializer<W>
where - W: Writer,

§

type Ok = ()

Must match the Ok type of our Serializer.
§

type Error = Error

Must match the Error type of our Serializer.
source§

fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<()>
where - T: ?Sized + Serialize,

Serialize a struct field.
source§

fn end(self) -> Result<()>

Finish serializing a struct.
source§

fn skip_field(&mut self, key: &'static str) -> Result<(), Self::Error>

Indicate that a struct field has been skipped. Read more
source§

impl<'a, W> SerializeStructVariant for &'a mut Serializer<W>
where - W: Writer,

§

type Ok = ()

Must match the Ok type of our Serializer.
§

type Error = Error

Must match the Error type of our Serializer.
source§

fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<()>
where - T: ?Sized + Serialize,

Serialize a struct variant field.
source§

fn end(self) -> Result<()>

Finish serializing a struct variant.
source§

fn skip_field(&mut self, key: &'static str) -> Result<(), Self::Error>

Indicate that a struct variant field has been skipped. Read more
source§

impl<'a, W> SerializeTuple for &'a mut Serializer<W>
where - W: Writer,

§

type Ok = ()

Must match the Ok type of our Serializer.
§

type Error = Error

Must match the Error type of our Serializer.
source§

fn serialize_element<T>(&mut self, value: &T) -> Result<()>
where - T: ?Sized + Serialize,

Serialize a tuple element.
source§

fn end(self) -> Result<()>

Finish serializing a tuple.
source§

impl<'a, W> SerializeTupleStruct for &'a mut Serializer<W>
where - W: Writer,

§

type Ok = ()

Must match the Ok type of our Serializer.
§

type Error = Error

Must match the Error type of our Serializer.
source§

fn serialize_field<T>(&mut self, value: &T) -> Result<()>
where - T: ?Sized + Serialize,

Serialize a tuple struct field.
source§

fn end(self) -> Result<()>

Finish serializing a tuple struct.
source§

impl<'a, W> SerializeTupleVariant for &'a mut Serializer<W>
where - W: Writer,

§

type Ok = ()

Must match the Ok type of our Serializer.
§

type Error = Error

Must match the Error type of our Serializer.
source§

fn serialize_field<T>(&mut self, value: &T) -> Result<()>
where - T: ?Sized + Serialize,

Serialize a tuple variant field.
source§

fn end(self) -> Result<()>

Finish serializing a tuple variant.
source§

impl<'a, W> Serializer for &'a mut Serializer<W>
where - W: Writer,

§

type Ok = ()

The output type produced by this Serializer during successful +

Trait Implementations§

source§

impl<'a, W> SerializeStruct for &'a mut Serializer<W>
where + W: Writer,

§

type Ok = ()

Must match the Ok type of our Serializer.
§

type Error = Error

Must match the Error type of our Serializer.
source§

fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<()>
where + T: ?Sized + Serialize,

Serialize a struct field.
source§

fn end(self) -> Result<()>

Finish serializing a struct.
source§

fn skip_field(&mut self, key: &'static str) -> Result<(), Self::Error>

Indicate that a struct field has been skipped. Read more
source§

impl<'a, W> SerializeStructVariant for &'a mut Serializer<W>
where + W: Writer,

§

type Ok = ()

Must match the Ok type of our Serializer.
§

type Error = Error

Must match the Error type of our Serializer.
source§

fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<()>
where + T: ?Sized + Serialize,

Serialize a struct variant field.
source§

fn end(self) -> Result<()>

Finish serializing a struct variant.
source§

fn skip_field(&mut self, key: &'static str) -> Result<(), Self::Error>

Indicate that a struct variant field has been skipped. Read more
source§

impl<'a, W> SerializeTuple for &'a mut Serializer<W>
where + W: Writer,

§

type Ok = ()

Must match the Ok type of our Serializer.
§

type Error = Error

Must match the Error type of our Serializer.
source§

fn serialize_element<T>(&mut self, value: &T) -> Result<()>
where + T: ?Sized + Serialize,

Serialize a tuple element.
source§

fn end(self) -> Result<()>

Finish serializing a tuple.
source§

impl<'a, W> SerializeTupleStruct for &'a mut Serializer<W>
where + W: Writer,

§

type Ok = ()

Must match the Ok type of our Serializer.
§

type Error = Error

Must match the Error type of our Serializer.
source§

fn serialize_field<T>(&mut self, value: &T) -> Result<()>
where + T: ?Sized + Serialize,

Serialize a tuple struct field.
source§

fn end(self) -> Result<()>

Finish serializing a tuple struct.
source§

impl<'a, W> SerializeTupleVariant for &'a mut Serializer<W>
where + W: Writer,

§

type Ok = ()

Must match the Ok type of our Serializer.
§

type Error = Error

Must match the Error type of our Serializer.
source§

fn serialize_field<T>(&mut self, value: &T) -> Result<()>
where + T: ?Sized + Serialize,

Serialize a tuple variant field.
source§

fn end(self) -> Result<()>

Finish serializing a tuple variant.
source§

impl<'a, W> Serializer for &'a mut Serializer<W>
where + W: Writer,

§

type Ok = ()

The output type produced by this Serializer during successful serialization. Most serializers that produce text or binary output should set Ok = () and serialize into an io::Write or buffer contained within the Serializer instance. Serializers that build in-memory data structures may be simplified by using Ok to propagate -the data structure around.
§

type Error = Error

The error type when some error occurs during serialization.
§

type SerializeSeq = CollectionSerializer<'a, W>

Type returned from serialize_seq for serializing the content of the -sequence.
§

type SerializeTuple = &'a mut Serializer<W>

Type returned from serialize_tuple for serializing the content of -the tuple.
§

type SerializeTupleStruct = &'a mut Serializer<W>

Type returned from serialize_tuple_struct for serializing the -content of the tuple struct.
§

type SerializeTupleVariant = &'a mut Serializer<W>

Type returned from serialize_tuple_variant for serializing the -content of the tuple variant.
§

type SerializeMap = CollectionSerializer<'a, W>

Type returned from serialize_map for serializing the content of the -map.
§

type SerializeStruct = &'a mut Serializer<W>

Type returned from serialize_struct for serializing the content of -the struct.
§

type SerializeStructVariant = &'a mut Serializer<W>

Type returned from serialize_struct_variant for serializing the -content of the struct variant.
source§

fn serialize_bool(self, value: bool) -> Result<()>

Serialize a bool value. Read more
source§

fn serialize_i8(self, value: i8) -> Result<()>

Serialize an i8 value. Read more
source§

fn serialize_i16(self, value: i16) -> Result<()>

Serialize an i16 value. Read more
source§

fn serialize_i32(self, value: i32) -> Result<()>

Serialize an i32 value. Read more
source§

fn serialize_i64(self, value: i64) -> Result<()>

Serialize an i64 value. Read more
source§

fn serialize_u8(self, value: u8) -> Result<()>

Serialize a u8 value. Read more
source§

fn serialize_u16(self, value: u16) -> Result<()>

Serialize a u16 value. Read more
source§

fn serialize_u32(self, value: u32) -> Result<()>

Serialize a u32 value. Read more
source§

fn serialize_u64(self, value: u64) -> Result<()>

Serialize a u64 value. Read more
source§

fn serialize_f32(self, _v: f32) -> Result<()>

Serialize an f32 value. Read more
source§

fn serialize_f64(self, _v: f64) -> Result<()>

Serialize an f64 value. Read more
source§

fn serialize_char(self, value: char) -> Result<()>

Serialize a character. Read more
source§

fn serialize_str(self, value: &str) -> Result<()>

Serialize a &str. Read more
source§

fn serialize_bytes(self, value: &[u8]) -> Result<()>

Serialize a chunk of raw byte data. Read more
source§

fn serialize_none(self) -> Result<()>

Serialize a None value. Read more
source§

fn serialize_some<T>(self, value: &T) -> Result<()>
where - T: ?Sized + Serialize,

Serialize a Some(T) value. Read more
source§

fn serialize_unit(self) -> Result<()>

Serialize a () value. Read more
source§

fn serialize_unit_struct(self, _name: &'static str) -> Result<()>

Serialize a unit struct like struct Unit or PhantomData<T>. Read more
source§

fn serialize_unit_variant( +the data structure around.

§

type Error = Error

The error type when some error occurs during serialization.
§

type SerializeSeq = CollectionSerializer<'a, W>

Type returned from serialize_seq for serializing the content of the +sequence.
§

type SerializeTuple = &'a mut Serializer<W>

Type returned from serialize_tuple for serializing the content of +the tuple.
§

type SerializeTupleStruct = &'a mut Serializer<W>

Type returned from serialize_tuple_struct for serializing the +content of the tuple struct.
§

type SerializeTupleVariant = &'a mut Serializer<W>

Type returned from serialize_tuple_variant for serializing the +content of the tuple variant.
§

type SerializeMap = CollectionSerializer<'a, W>

Type returned from serialize_map for serializing the content of the +map.
§

type SerializeStruct = &'a mut Serializer<W>

Type returned from serialize_struct for serializing the content of +the struct.
§

type SerializeStructVariant = &'a mut Serializer<W>

Type returned from serialize_struct_variant for serializing the +content of the struct variant.
source§

fn serialize_bool(self, value: bool) -> Result<()>

Serialize a bool value. Read more
source§

fn serialize_i8(self, value: i8) -> Result<()>

Serialize an i8 value. Read more
source§

fn serialize_i16(self, value: i16) -> Result<()>

Serialize an i16 value. Read more
source§

fn serialize_i32(self, value: i32) -> Result<()>

Serialize an i32 value. Read more
source§

fn serialize_i64(self, value: i64) -> Result<()>

Serialize an i64 value. Read more
source§

fn serialize_u8(self, value: u8) -> Result<()>

Serialize a u8 value. Read more
source§

fn serialize_u16(self, value: u16) -> Result<()>

Serialize a u16 value. Read more
source§

fn serialize_u32(self, value: u32) -> Result<()>

Serialize a u32 value. Read more
source§

fn serialize_u64(self, value: u64) -> Result<()>

Serialize a u64 value. Read more
source§

fn serialize_f32(self, _v: f32) -> Result<()>

Serialize an f32 value. Read more
source§

fn serialize_f64(self, _v: f64) -> Result<()>

Serialize an f64 value. Read more
source§

fn serialize_char(self, value: char) -> Result<()>

Serialize a character. Read more
source§

fn serialize_str(self, value: &str) -> Result<()>

Serialize a &str. Read more
source§

fn serialize_bytes(self, value: &[u8]) -> Result<()>

Serialize a chunk of raw byte data. Read more
source§

fn serialize_none(self) -> Result<()>

Serialize a None value. Read more
source§

fn serialize_some<T>(self, value: &T) -> Result<()>
where + T: ?Sized + Serialize,

Serialize a Some(T) value. Read more
source§

fn serialize_unit(self) -> Result<()>

Serialize a () value. Read more
source§

fn serialize_unit_struct(self, _name: &'static str) -> Result<()>

Serialize a unit struct like struct Unit or PhantomData<T>. Read more
source§

fn serialize_unit_variant( self, _name: &'static str, variant_index: u32, _variant: &'static str, -) -> Result<()>

Serialize a unit variant like E::A in enum E { A, B }. Read more
source§

fn serialize_newtype_struct<T>( +) -> Result<()>

Serialize a unit variant like E::A in enum E { A, B }. Read more
source§

fn serialize_newtype_struct<T>( self, _name: &'static str, value: &T, ) -> Result<()>
where - T: ?Sized + Serialize,

Serialize a newtype struct like struct Millimeters(u8). Read more
source§

fn serialize_newtype_variant<T>( + T: ?Sized + Serialize,

Serialize a newtype struct like struct Millimeters(u8). Read more
source§

fn serialize_newtype_variant<T>( self, name: &'static str, variant_index: u32, variant: &'static str, value: &T, ) -> Result<()>
where - T: ?Sized + Serialize,

Serialize a newtype variant like E::N in enum E { N(u8) }. Read more
source§

fn serialize_seq( + T: ?Sized + Serialize,

Serialize a newtype variant like E::N in enum E { N(u8) }. Read more
source§

fn serialize_seq( self, len: Option<usize>, ) -> Result<CollectionSerializer<'a, W>>

Begin to serialize a variably sized sequence. This call must be followed by zero or more calls to serialize_element, then a call to -end. Read more
source§

fn serialize_tuple(self, len: usize) -> Result<&'a mut Serializer<W>>

Begin to serialize a statically sized sequence whose length will be +end. Read more
source§

fn serialize_tuple(self, len: usize) -> Result<&'a mut Serializer<W>>

Begin to serialize a statically sized sequence whose length will be known at deserialization time without looking at the serialized data. This call must be followed by zero or more calls to serialize_element, -then a call to end. Read more
source§

fn serialize_tuple_struct( +then a call to end. Read more

source§

fn serialize_tuple_struct( self, _name: &'static str, len: usize, ) -> Result<&'a mut Serializer<W>>

Begin to serialize a tuple struct like struct Rgb(u8, u8, u8). This call must be followed by zero or more calls to serialize_field, then a -call to end. Read more
source§

fn serialize_tuple_variant( +call to end. Read more

source§

fn serialize_tuple_variant( self, name: &'static str, variant_index: u32, variant: &'static str, len: usize, ) -> Result<&'a mut Serializer<W>>

Begin to serialize a tuple variant like E::T in enum E { T(u8, u8) }. This call must be followed by zero or more calls to -serialize_field, then a call to end. Read more
source§

fn serialize_map( +serialize_field, then a call to end. Read more

source§

fn serialize_map( self, len: Option<usize>, ) -> Result<CollectionSerializer<'a, W>>

Begin to serialize a map. This call must be followed by zero or more -calls to serialize_key and serialize_value, then a call to end. Read more
source§

fn serialize_struct( +calls to serialize_key and serialize_value, then a call to end. Read more

source§

fn serialize_struct( self, _name: &'static str, len: usize, -) -> Result<Self::SerializeStruct>

Begin to serialize a struct like struct Rgb { r: u8, g: u8, b: u8 }. +) -> Result<Self::SerializeStruct>
Begin to serialize a struct like struct Rgb { r: u8, g: u8, b: u8 }. This call must be followed by zero or more calls to serialize_field, -then a call to end. Read more
source§

fn serialize_struct_variant( +then a call to end. Read more

source§

fn serialize_struct_variant( self, name: &'static str, variant_index: u32, variant: &'static str, len: usize, -) -> Result<Self::SerializeStruct>

Begin to serialize a struct variant like E::S in enum E { S { r: u8, g: u8, b: u8 } }. This call must be followed by zero or more calls to -serialize_field, then a call to end. Read more
source§

fn collect_str<T>(self, _value: &T) -> Result<Self::Ok>
where - T: Display + ?Sized,

Serialize a string produced by an implementation of Display. Read more
source§

fn is_human_readable(&self) -> bool

Determine whether Serialize implementations should serialize in -human-readable form. Read more
source§

fn serialize_i128(self, v: i128) -> Result<Self::Ok, Self::Error>

Serialize an i128 value. Read more
source§

fn serialize_u128(self, v: u128) -> Result<Self::Ok, Self::Error>

Serialize a u128 value. Read more
source§

fn collect_seq<I>(self, iter: I) -> Result<Self::Ok, Self::Error>
where +) -> Result<Self::SerializeStruct>

Begin to serialize a struct variant like E::S in enum E { S { r: u8, g: u8, b: u8 } }. This call must be followed by zero or more calls to +serialize_field, then a call to end. Read more
source§

fn collect_str<T>(self, _value: &T) -> Result<Self::Ok>
where + T: Display + ?Sized,

Serialize a string produced by an implementation of Display. Read more
source§

fn is_human_readable(&self) -> bool

Determine whether Serialize implementations should serialize in +human-readable form. Read more
source§

fn serialize_i128(self, v: i128) -> Result<Self::Ok, Self::Error>

Serialize an i128 value. Read more
source§

fn serialize_u128(self, v: u128) -> Result<Self::Ok, Self::Error>

Serialize a u128 value. Read more
source§

fn collect_seq<I>(self, iter: I) -> Result<Self::Ok, Self::Error>
where I: IntoIterator, - <I as IntoIterator>::Item: Serialize,

Collect an iterator as a sequence. Read more
source§

fn collect_map<K, V, I>(self, iter: I) -> Result<Self::Ok, Self::Error>
where - K: Serialize, - V: Serialize, - I: IntoIterator<Item = (K, V)>,

Collect an iterator as a map. Read more

Auto Trait Implementations§

§

impl<W> Freeze for Serializer<W>
where + <I as IntoIterator>::Item: Serialize,

Collect an iterator as a sequence. Read more
source§

fn collect_map<K, V, I>(self, iter: I) -> Result<Self::Ok, Self::Error>
where + K: Serialize, + V: Serialize, + I: IntoIterator<Item = (K, V)>,

Collect an iterator as a map. Read more

Auto Trait Implementations§

§

impl<W> Freeze for Serializer<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for Serializer<W>
where W: RefUnwindSafe,

§

impl<W> Send for Serializer<W>
where W: Send,

§

impl<W> Sync for Serializer<W>
where diff --git a/search-index.js b/search-index.js index 32ff008..7a5f09f 100644 --- a/search-index.js +++ b/search-index.js @@ -1,5 +1,5 @@ var searchIndex = new Map(JSON.parse('[\ -["cbor_smol",{"t":"EEHHHCCCFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNHNNHNNNPPPPPPPPPPPPPPPPGPPPIPPPPPNNNNNNNNNNNNNNNNRFKNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMN","n":["Error","Result","cbor_deserialize","cbor_serialize","cbor_serialize_to","de","error","ser","Deserializer","borrow","borrow_mut","deserialize_any","deserialize_bool","deserialize_byte_buf","deserialize_bytes","deserialize_char","deserialize_enum","deserialize_f32","deserialize_f64","deserialize_i16","deserialize_i32","deserialize_i64","deserialize_i8","deserialize_identifier","deserialize_ignored_any","deserialize_map","deserialize_newtype_struct","deserialize_option","deserialize_seq","deserialize_str","deserialize_string","deserialize_struct","deserialize_tuple","deserialize_tuple_struct","deserialize_u16","deserialize_u32","deserialize_u64","deserialize_u8","deserialize_unit","deserialize_unit_struct","from","from_bytes","from_bytes","into","take_from_bytes","try_from","try_into","type_id","DeserializeBadBool","DeserializeBadEnum","DeserializeBadI16","DeserializeBadI32","DeserializeBadI64","DeserializeBadI8","DeserializeBadMajor","DeserializeBadU16","DeserializeBadU32","DeserializeBadU64","DeserializeBadU8","DeserializeBadUtf8","DeserializeExpectedNull","DeserializeNonMinimal","DeserializeUnexpectedEnd","Err","Error","InexistentSliceToArrayError","NotYetImplemented","Ok","Result","SerdeDeCustom","SerdeMissingField","SerdeSerCustom","SerializeBufferFull","WontImplement","borrow","borrow_mut","clone","clone_to_uninit","clone_to_uninit","custom","custom","eq","fmt","fmt","from","into","missing_field","try_from","try_into","type_id","Error","Serializer","Writer","borrow","borrow_mut","collect_str","end","end","end","end","end","from","into","into_inner","is_human_readable","new","serialize_bool","serialize_bytes","serialize_char","serialize_element","serialize_f32","serialize_f64","serialize_field","serialize_field","serialize_field","serialize_field","serialize_i16","serialize_i32","serialize_i64","serialize_i8","serialize_map","serialize_newtype_struct","serialize_newtype_variant","serialize_none","serialize_seq","serialize_some","serialize_str","serialize_struct","serialize_struct_variant","serialize_tuple","serialize_tuple_struct","serialize_tuple_variant","serialize_u16","serialize_u32","serialize_u64","serialize_u8","serialize_unit","serialize_unit_struct","serialize_unit_variant","try_from","try_into","type_id","write_all","written"],"q":[[0,"cbor_smol"],[8,"cbor_smol::de"],[48,"cbor_smol::error"],[90,"cbor_smol::ser"],[144,"serde::de"],[145,"core::marker"],[146,"serde::ser"],[147,"core::result"],[148,"core::any"],[149,"core::fmt"],[150,"core::option"],[151,"core::convert"]],"i":[0,0,0,0,0,0,0,0,0,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,11,11,0,11,11,11,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,4,0,17,17,4,0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,10,0,0,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,10,23],"f":"``{{{f{{d{b}}}}}{{h{c}}}j}{{{f{c}}{f{l{d{b}}}}}{{h{{f{{d{b}}}}}}}{nA`}}{{{f{c}}e}{{h{Ab}}}{nA`}Ad}````{{{f{c}}}{{f{e}}}{}{}}{{{f{lc}}}{{f{le}}}{}{}}{{{f{lAf}}c}hAh}0000{{{f{lAf}}{f{Aj}}{f{{d{{f{Aj}}}}}}c}hAh}111111111{{{f{lAf}}{f{Aj}}c}hAh}22221{{{f{lAf}}Abc}hAh}{{{f{lAf}}{f{Aj}}Abc}hAh}444442{cc{}}:{{{f{{d{b}}}}}Af}{ce{}{}}{{{f{{d{b}}}}}{{h{{Al{c{f{{d{b}}}}}}}}}j}{c{{An{e}}}{}{}}0{{{f{c}}}B`{}}``````````````````````````<;{{{f{Bb}}}Bb}{{{f{c}}}Bd{}}0{cBbBf}0{{{f{Bb}}{f{Bb}}}Bh}{{{f{Bb}}{f{lBj}}}Bl}0:8{{{f{Aj}}}Bb}776```{{{f{c}}}{{f{e}}}{}{}}{{{f{lc}}}{{f{le}}}{}{}}{{{f{l{Bn{c}}}}{f{e}}}{{h{g}}}Ad{Bfn}{}}{{{f{l{Bn{c}}}}}{{h{Bd}}}Ad}0000?={{{Bn{c}}}cAd}{{{f{{f{l{Bn{c}}}}}}}BhAd}{c{{Bn{c}}}Ad}{{{f{l{Bn{c}}}}Bh}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}{f{{d{b}}}}}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}C`}{{h{Bd}}}Ad}{{{f{l{f{l{Bn{c}}}}}}{f{e}}}{{h{Bd}}}Ad{nA`}}{{{f{l{Bn{c}}}}Cb}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}Cd}{{h{Bd}}}Ad}2{{{f{l{f{l{Bn{c}}}}}}{f{Aj}}{f{e}}}{{h{Bd}}}Ad{nA`}}03{{{f{l{Bn{c}}}}Cf}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}Ch}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}Cj}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}Cl}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}{Cn{Ab}}}{{h{{`{c}}}}}Ad}{{{f{l{Bn{c}}}}{f{Aj}}{f{e}}}{{h{Bd}}}Ad{nA`}}{{{f{l{Bn{c}}}}{f{Aj}}D`{f{Aj}}{f{e}}}{{h{Bd}}}Ad{nA`}}{{{f{l{Bn{c}}}}}{{h{Bd}}}Ad}3{{{f{l{Bn{c}}}}{f{e}}}{{h{Bd}}}Ad{nA`}}{{{f{l{Bn{c}}}}{f{Aj}}}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}{f{Aj}}Ab}{{h{e}}}Ad{}}{{{f{l{Bn{c}}}}{f{Aj}}D`{f{Aj}}Ab}{{h{e}}}Ad{}}{{{f{l{Bn{c}}}}Ab}{{h{{f{l{Bn{c}}}}}}}Ad}{{{f{l{Bn{c}}}}{f{Aj}}Ab}{{h{{f{l{Bn{c}}}}}}}Ad}{{{f{l{Bn{c}}}}{f{Aj}}D`{f{Aj}}Ab}{{h{{f{l{Bn{c}}}}}}}Ad}{{{f{l{Bn{c}}}}Db}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}D`}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}Dd}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}b}{{h{Bd}}}Ad};9{{{f{l{Bn{c}}}}{f{Aj}}D`{f{Aj}}}{{h{Bd}}}Ad}{c{{An{e}}}{}{}}0{{{f{c}}}B`{}}{{{f{l{Ad{}{{Df{c}}}}}}{f{{d{b}}}}}{{h{Bdc}}}{{Dh{Bb}}}}{{{f{{Bn{c}}}}}AbAd}","D":"E`","p":[[1,"u8"],[1,"slice"],[1,"reference"],[8,"Result",48],[10,"Deserialize",144],[0,"mut"],[10,"Sized",145],[10,"Serialize",146],[1,"usize"],[10,"Writer",90],[5,"Deserializer",8],[10,"Visitor",144],[1,"str"],[1,"tuple"],[6,"Result",147],[5,"TypeId",148],[6,"Error",48],[1,"unit"],[10,"Display",149],[1,"bool"],[5,"Formatter",149],[8,"Result",149],[5,"Serializer",90],[1,"char"],[1,"f32"],[1,"f64"],[1,"i16"],[1,"i32"],[1,"i64"],[1,"i8"],[6,"Option",150],[1,"u32"],[1,"u16"],[1,"u64"],[17,"Error"],[10,"Into",151]],"r":[[0,48],[1,48]],"b":[[79,"impl-Error-for-Error"],[80,"impl-Error-for-Error"],[82,"impl-Display-for-Error"],[83,"impl-Debug-for-Error"],[96,"impl-SerializeTupleVariant-for-%26mut+Serializer%3CW%3E"],[97,"impl-SerializeTupleStruct-for-%26mut+Serializer%3CW%3E"],[98,"impl-SerializeTuple-for-%26mut+Serializer%3CW%3E"],[99,"impl-SerializeStruct-for-%26mut+Serializer%3CW%3E"],[100,"impl-SerializeStructVariant-for-%26mut+Serializer%3CW%3E"],[112,"impl-SerializeTupleStruct-for-%26mut+Serializer%3CW%3E"],[113,"impl-SerializeStruct-for-%26mut+Serializer%3CW%3E"],[114,"impl-SerializeStructVariant-for-%26mut+Serializer%3CW%3E"],[115,"impl-SerializeTupleVariant-for-%26mut+Serializer%3CW%3E"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAGgACQAAAAQABgACAAoAHgAuAAIASwAJAFcAAwBcAAkAaQAlAJAAAAA="}]\ +["cbor_smol",{"t":"EEHHHCCCFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNHNNHNNNPPPPPPPPPPPPPPPPGPPPIPPPPPNNNNNNNNNNNNNNNNRFKNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMN","n":["Error","Result","cbor_deserialize","cbor_serialize","cbor_serialize_to","de","error","ser","Deserializer","borrow","borrow_mut","deserialize_any","deserialize_bool","deserialize_byte_buf","deserialize_bytes","deserialize_char","deserialize_enum","deserialize_f32","deserialize_f64","deserialize_i16","deserialize_i32","deserialize_i64","deserialize_i8","deserialize_identifier","deserialize_ignored_any","deserialize_map","deserialize_newtype_struct","deserialize_option","deserialize_seq","deserialize_str","deserialize_string","deserialize_struct","deserialize_tuple","deserialize_tuple_struct","deserialize_u16","deserialize_u32","deserialize_u64","deserialize_u8","deserialize_unit","deserialize_unit_struct","from","from_bytes","from_bytes","into","take_from_bytes","try_from","try_into","type_id","DeserializeBadBool","DeserializeBadEnum","DeserializeBadI16","DeserializeBadI32","DeserializeBadI64","DeserializeBadI8","DeserializeBadMajor","DeserializeBadU16","DeserializeBadU32","DeserializeBadU64","DeserializeBadU8","DeserializeBadUtf8","DeserializeExpectedNull","DeserializeNonMinimal","DeserializeUnexpectedEnd","Err","Error","InexistentSliceToArrayError","NotYetImplemented","Ok","Result","SerdeDeCustom","SerdeMissingField","SerdeSerCustom","SerializeBufferFull","WontImplement","borrow","borrow_mut","clone","clone_to_uninit","clone_to_uninit","custom","custom","eq","fmt","fmt","from","into","missing_field","try_from","try_into","type_id","Error","Serializer","Writer","borrow","borrow_mut","collect_str","end","end","end","end","end","from","into","into_inner","is_human_readable","new","serialize_bool","serialize_bytes","serialize_char","serialize_element","serialize_f32","serialize_f64","serialize_field","serialize_field","serialize_field","serialize_field","serialize_i16","serialize_i32","serialize_i64","serialize_i8","serialize_map","serialize_newtype_struct","serialize_newtype_variant","serialize_none","serialize_seq","serialize_some","serialize_str","serialize_struct","serialize_struct_variant","serialize_tuple","serialize_tuple_struct","serialize_tuple_variant","serialize_u16","serialize_u32","serialize_u64","serialize_u8","serialize_unit","serialize_unit_struct","serialize_unit_variant","try_from","try_into","type_id","write_all","written"],"q":[[0,"cbor_smol"],[8,"cbor_smol::de"],[48,"cbor_smol::error"],[90,"cbor_smol::ser"],[144,"serde::de"],[145,"core::marker"],[146,"serde::ser"],[147,"core::result"],[148,"core::any"],[149,"core::fmt"],[150,"core::option"],[151,"core::convert"]],"i":[0,0,0,0,0,0,0,0,0,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,11,11,0,11,11,11,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,4,0,17,17,4,0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,10,0,0,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,10,23],"f":"``{{{f{{d{b}}}}}{{h{c}}}j}{{{f{c}}{f{l{d{b}}}}}{{h{{f{{d{b}}}}}}}{nA`}}{{{f{c}}e}{{h{Ab}}}{nA`}Ad}````{{{f{c}}}{{f{e}}}{}{}}{{{f{lc}}}{{f{le}}}{}{}}{{{f{lAf}}c}hAh}0000{{{f{lAf}}{f{Aj}}{f{{d{{f{Aj}}}}}}c}hAh}111111111{{{f{lAf}}{f{Aj}}c}hAh}22221{{{f{lAf}}Abc}hAh}{{{f{lAf}}{f{Aj}}Abc}hAh}444442{cc{}}:{{{f{{d{b}}}}}Af}{ce{}{}}{{{f{{d{b}}}}}{{h{{Al{c{f{{d{b}}}}}}}}}j}{c{{An{e}}}{}{}}0{{{f{c}}}B`{}}``````````````````````````<;{{{f{Bb}}}Bb}{{{f{c}}}Bd{}}0{cBbBf}0{{{f{Bb}}{f{Bb}}}Bh}{{{f{Bb}}{f{lBj}}}Bl}0:8{{{f{Aj}}}Bb}776```{{{f{c}}}{{f{e}}}{}{}}{{{f{lc}}}{{f{le}}}{}{}}{{{f{l{Bn{c}}}}{f{e}}}{{h{g}}}Ad{Bfn}{}}{{{f{l{Bn{c}}}}}{{h{Bd}}}Ad}0000?={{{Bn{c}}}cAd}{{{f{{f{l{Bn{c}}}}}}}BhAd}{c{{Bn{c}}}Ad}{{{f{l{Bn{c}}}}Bh}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}{f{{d{b}}}}}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}C`}{{h{Bd}}}Ad}{{{f{l{f{l{Bn{c}}}}}}{f{e}}}{{h{Bd}}}Ad{nA`}}{{{f{l{Bn{c}}}}Cb}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}Cd}{{h{Bd}}}Ad}{{{f{l{f{l{Bn{c}}}}}}{f{Aj}}{f{e}}}{{h{Bd}}}Ad{nA`}}033{{{f{l{Bn{c}}}}Cf}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}Ch}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}Cj}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}Cl}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}{Cn{Ab}}}{{h{{`{c}}}}}Ad}{{{f{l{Bn{c}}}}{f{Aj}}{f{e}}}{{h{Bd}}}Ad{nA`}}{{{f{l{Bn{c}}}}{f{Aj}}D`{f{Aj}}{f{e}}}{{h{Bd}}}Ad{nA`}}{{{f{l{Bn{c}}}}}{{h{Bd}}}Ad}3{{{f{l{Bn{c}}}}{f{e}}}{{h{Bd}}}Ad{nA`}}{{{f{l{Bn{c}}}}{f{Aj}}}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}{f{Aj}}Ab}{{h{e}}}Ad{}}{{{f{l{Bn{c}}}}{f{Aj}}D`{f{Aj}}Ab}{{h{e}}}Ad{}}{{{f{l{Bn{c}}}}Ab}{{h{{f{l{Bn{c}}}}}}}Ad}{{{f{l{Bn{c}}}}{f{Aj}}Ab}{{h{{f{l{Bn{c}}}}}}}Ad}{{{f{l{Bn{c}}}}{f{Aj}}D`{f{Aj}}Ab}{{h{{f{l{Bn{c}}}}}}}Ad}{{{f{l{Bn{c}}}}Db}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}D`}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}Dd}{{h{Bd}}}Ad}{{{f{l{Bn{c}}}}b}{{h{Bd}}}Ad};9{{{f{l{Bn{c}}}}{f{Aj}}D`{f{Aj}}}{{h{Bd}}}Ad}{c{{An{e}}}{}{}}0{{{f{c}}}B`{}}{{{f{l{Ad{}{{Df{c}}}}}}{f{{d{b}}}}}{{h{Bdc}}}{{Dh{Bb}}}}{{{f{{Bn{c}}}}}AbAd}","D":"E`","p":[[1,"u8"],[1,"slice"],[1,"reference"],[8,"Result",48],[10,"Deserialize",144],[0,"mut"],[10,"Sized",145],[10,"Serialize",146],[1,"usize"],[10,"Writer",90],[5,"Deserializer",8],[10,"Visitor",144],[1,"str"],[1,"tuple"],[6,"Result",147],[5,"TypeId",148],[6,"Error",48],[1,"unit"],[10,"Display",149],[1,"bool"],[5,"Formatter",149],[8,"Result",149],[5,"Serializer",90],[1,"char"],[1,"f32"],[1,"f64"],[1,"i16"],[1,"i32"],[1,"i64"],[1,"i8"],[6,"Option",150],[1,"u32"],[1,"u16"],[1,"u64"],[17,"Error"],[10,"Into",151]],"r":[[0,48],[1,48]],"b":[[79,"impl-Error-for-Error"],[80,"impl-Error-for-Error"],[82,"impl-Display-for-Error"],[83,"impl-Debug-for-Error"],[96,"impl-SerializeTuple-for-%26mut+Serializer%3CW%3E"],[97,"impl-SerializeStructVariant-for-%26mut+Serializer%3CW%3E"],[98,"impl-SerializeStruct-for-%26mut+Serializer%3CW%3E"],[99,"impl-SerializeTupleStruct-for-%26mut+Serializer%3CW%3E"],[100,"impl-SerializeTupleVariant-for-%26mut+Serializer%3CW%3E"],[112,"impl-SerializeStruct-for-%26mut+Serializer%3CW%3E"],[113,"impl-SerializeStructVariant-for-%26mut+Serializer%3CW%3E"],[114,"impl-SerializeTupleVariant-for-%26mut+Serializer%3CW%3E"],[115,"impl-SerializeTupleStruct-for-%26mut+Serializer%3CW%3E"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAGgACQAAAAQABgACAAoAHgAuAAIASwAJAFcAAwBcAAkAaQAlAJAAAAA="}]\ ]')); if (typeof exports !== 'undefined') exports.searchIndex = searchIndex; else if (window.initSearch) window.initSearch(searchIndex); diff --git a/src/cbor_smol/error.rs.html b/src/cbor_smol/error.rs.html index c928847..013fad7 100644 --- a/src/cbor_smol/error.rs.html +++ b/src/cbor_smol/error.rs.html @@ -166,7 +166,7 @@ /// This is a feature that cbor-smol intends to support, but does not yet NotYetImplemented, /// The serialize buffer is full - SerializeBufferFull(usize), + SerializeBufferFull, // /// The length of a sequence must be known // SerializeSeqLengthUnknown, /// Hit the end of buffer, expected more data @@ -229,7 +229,7 @@ NotYetImplemented => { "This is a feature that cbor-smol intends to support, but does not yet" } - SerializeBufferFull(i) => "The serialize buffer is full", + SerializeBufferFull => "The serialize buffer is full", // SerializeSeqLengthUnknown => "The length of a sequence must be known", DeserializeUnexpectedEnd => "Hit the end of buffer, expected more data", // DeserializeBadVarint => { diff --git a/src/cbor_smol/ser.rs.html b/src/cbor_smol/ser.rs.html index c875b48..17a5484 100644 --- a/src/cbor_smol/ser.rs.html +++ b/src/cbor_smol/ser.rs.html @@ -630,7 +630,7 @@ let l = buf.len(); if self.len() < l { // This buffer will not fit in our slice - return Err(Error::SerializeBufferFull(0)); + return Err(Error::SerializeBufferFull); } let (current, rem) = mem::take(self).split_at_mut(l); current.copy_from_slice(buf); @@ -644,7 +644,7 @@ type Error = Error; fn write_all(&mut self, buf: &[u8]) -> Result<()> { self.extend_from_slice(buf) - .or(Err(Error::SerializeBufferFull(self.len()))) + .or(Err(Error::SerializeBufferFull)) } } @@ -653,7 +653,7 @@ type Error = Error; fn write_all(&mut self, buf: &[u8]) -> Result<()> { self.extend_from_slice(buf) - .or(Err(Error::SerializeBufferFull(self.len()))) + .or(Err(Error::SerializeBufferFull)) } } @@ -662,7 +662,7 @@ type Error = Error; fn write_all(&mut self, buf: &[u8]) -> Result<()> { self.extend_from_slice(buf) - .or(Err(Error::SerializeBufferFull(self.len()))) + .or(Err(Error::SerializeBufferFull)) } } @@ -671,7 +671,7 @@ type Error = Error; fn write_all(&mut self, buf: &[u8]) -> Result<()> { self.extend_from_slice(buf) - .or(Err(Error::SerializeBufferFull(self.len()))) + .or(Err(Error::SerializeBufferFull)) } } diff --git a/trait.impl/serde/de/trait.Deserializer.js b/trait.impl/serde/de/trait.Deserializer.js index 8e02f25..49c5e2b 100644 --- a/trait.impl/serde/de/trait.Deserializer.js +++ b/trait.impl/serde/de/trait.Deserializer.js @@ -1,3 +1,3 @@ (function() {var implementors = { -"cbor_smol":[["impl<'de, 'a> Deserializer<'de> for &'a mut Deserializer<'de>"]] +"cbor_smol":[["impl<'de, 'a> Deserializer<'de> for &'a mut Deserializer<'de>"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/serde/de/trait.Error.js b/trait.impl/serde/de/trait.Error.js index fdae97e..45cd8e5 100644 --- a/trait.impl/serde/de/trait.Error.js +++ b/trait.impl/serde/de/trait.Error.js @@ -1,3 +1,3 @@ (function() {var implementors = { -"cbor_smol":[["impl Error for Error"]] +"cbor_smol":[["impl Error for Error"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/serde/ser/trait.Error.js b/trait.impl/serde/ser/trait.Error.js index 0a581e1..2f4ead6 100644 --- a/trait.impl/serde/ser/trait.Error.js +++ b/trait.impl/serde/ser/trait.Error.js @@ -1,3 +1,3 @@ (function() {var implementors = { -"cbor_smol":[["impl Error for Error"]] +"cbor_smol":[["impl Error for Error"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/serde/ser/trait.SerializeStruct.js b/trait.impl/serde/ser/trait.SerializeStruct.js index b5fe973..73cec78 100644 --- a/trait.impl/serde/ser/trait.SerializeStruct.js +++ b/trait.impl/serde/ser/trait.SerializeStruct.js @@ -1,3 +1,3 @@ (function() {var implementors = { -"cbor_smol":[["impl<'a, W> SerializeStruct for &'a mut Serializer<W>
where\n W: Writer,
"]] +"cbor_smol":[["impl<'a, W> SerializeStruct for &'a mut Serializer<W>
where\n W: Writer,
"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/serde/ser/trait.SerializeStructVariant.js b/trait.impl/serde/ser/trait.SerializeStructVariant.js index 3124189..c5d88c9 100644 --- a/trait.impl/serde/ser/trait.SerializeStructVariant.js +++ b/trait.impl/serde/ser/trait.SerializeStructVariant.js @@ -1,3 +1,3 @@ (function() {var implementors = { -"cbor_smol":[["impl<'a, W> SerializeStructVariant for &'a mut Serializer<W>
where\n W: Writer,
"]] +"cbor_smol":[["impl<'a, W> SerializeStructVariant for &'a mut Serializer<W>
where\n W: Writer,
"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/serde/ser/trait.SerializeTuple.js b/trait.impl/serde/ser/trait.SerializeTuple.js index d375f75..889def4 100644 --- a/trait.impl/serde/ser/trait.SerializeTuple.js +++ b/trait.impl/serde/ser/trait.SerializeTuple.js @@ -1,3 +1,3 @@ (function() {var implementors = { -"cbor_smol":[["impl<'a, W> SerializeTuple for &'a mut Serializer<W>
where\n W: Writer,
"]] +"cbor_smol":[["impl<'a, W> SerializeTuple for &'a mut Serializer<W>
where\n W: Writer,
"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/serde/ser/trait.SerializeTupleStruct.js b/trait.impl/serde/ser/trait.SerializeTupleStruct.js index fd20f25..c47cfc1 100644 --- a/trait.impl/serde/ser/trait.SerializeTupleStruct.js +++ b/trait.impl/serde/ser/trait.SerializeTupleStruct.js @@ -1,3 +1,3 @@ (function() {var implementors = { -"cbor_smol":[["impl<'a, W> SerializeTupleStruct for &'a mut Serializer<W>
where\n W: Writer,
"]] +"cbor_smol":[["impl<'a, W> SerializeTupleStruct for &'a mut Serializer<W>
where\n W: Writer,
"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/serde/ser/trait.SerializeTupleVariant.js b/trait.impl/serde/ser/trait.SerializeTupleVariant.js index a194ddc..f66745a 100644 --- a/trait.impl/serde/ser/trait.SerializeTupleVariant.js +++ b/trait.impl/serde/ser/trait.SerializeTupleVariant.js @@ -1,3 +1,3 @@ (function() {var implementors = { -"cbor_smol":[["impl<'a, W> SerializeTupleVariant for &'a mut Serializer<W>
where\n W: Writer,
"]] +"cbor_smol":[["impl<'a, W> SerializeTupleVariant for &'a mut Serializer<W>
where\n W: Writer,
"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/serde/ser/trait.Serializer.js b/trait.impl/serde/ser/trait.Serializer.js index e48c29f..01e23b3 100644 --- a/trait.impl/serde/ser/trait.Serializer.js +++ b/trait.impl/serde/ser/trait.Serializer.js @@ -1,3 +1,3 @@ (function() {var implementors = { -"cbor_smol":[["impl<'a, W> Serializer for &'a mut Serializer<W>
where\n W: Writer,
"]] +"cbor_smol":[["impl<'a, W> Serializer for &'a mut Serializer<W>
where\n W: Writer,
"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/type.impl/core/result/enum.Result.js b/type.impl/core/result/enum.Result.js index 4a0ef66..d04df16 100644 --- a/type.impl/core/result/enum.Result.js +++ b/type.impl/core/result/enum.Result.js @@ -1,3 +1,3 @@ (function() {var type_impls = { -"cbor_smol":[["
1.0.0 · source§

impl<T, E> Clone for Result<T, E>
where\n T: Clone,\n E: Clone,

source§

fn clone(&self) -> Result<T, E>

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &Result<T, E>)

Performs copy-assignment from source. Read more
","Clone","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> Debug for Result<T, E>
where\n T: Debug,\n E: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","cbor_smol::error::Result"],["
source§

impl<'de, T, E> Deserialize<'de> for Result<T, E>
where\n T: Deserialize<'de>,\n E: Deserialize<'de>,

source§

fn deserialize<D>(\n deserializer: D,\n) -> Result<Result<T, E>, <D as Deserializer<'de>>::Error>
where\n D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
","Deserialize<'de>","cbor_smol::error::Result"],["
1.0.0 · source§

impl<A, E, V> FromIterator<Result<A, E>> for Result<V, E>
where\n V: FromIterator<A>,

source§

fn from_iter<I>(iter: I) -> Result<V, E>
where\n I: IntoIterator<Item = Result<A, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err occur, a\ncontainer with the values of each Result is returned.

\n

Here is an example which increments every integer in a vector,\nchecking for overflow:

\n\n
let v = vec![1, 2];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n    x.checked_add(1).ok_or(\"Overflow!\")\n).collect();\nassert_eq!(res, Ok(vec![2, 3]));
\n

Here is another example that tries to subtract one from another list\nof integers, this time checking for underflow:

\n\n
let v = vec![1, 2, 0];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n    x.checked_sub(1).ok_or(\"Underflow!\")\n).collect();\nassert_eq!(res, Err(\"Underflow!\"));
\n

Here is a variation on the previous example, showing that no\nfurther elements are taken from iter after the first Err.

\n\n
let v = vec![3, 2, 1, 10];\nlet mut shared = 0;\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32| {\n    shared += x;\n    x.checked_sub(2).ok_or(\"Underflow!\")\n}).collect();\nassert_eq!(res, Err(\"Underflow!\"));\nassert_eq!(shared, 6);
\n

Since the third element caused an underflow, no further elements were taken,\nso the final value of shared is 6 (= 3 + 2 + 1), not 16.

\n
","FromIterator>","cbor_smol::error::Result"],["
source§

impl<T, E, F> FromResidual<Result<Infallible, E>> for Result<T, F>
where\n F: From<E>,

source§

fn from_residual(residual: Result<Infallible, E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
","FromResidual>","cbor_smol::error::Result"],["
source§

impl<T, E, F> FromResidual<Yeet<E>> for Result<T, F>
where\n F: From<E>,

source§

fn from_residual(_: Yeet<E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
","FromResidual>","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> Hash for Result<T, E>
where\n T: Hash,\n E: Hash,

source§

fn hash<__H>(&self, state: &mut __H)
where\n __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where\n H: Hasher,\n Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
","Hash","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> IntoIterator for Result<T, E>

source§

fn into_iter(self) -> IntoIter<T>

Returns a consuming iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(5);\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, [5]);\n\nlet x: Result<u32, &str> = Err(\"nothing!\");\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, []);
\n
§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
","IntoIterator","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> Ord for Result<T, E>
where\n T: Ord,\n E: Ord,

source§

fn cmp(&self, other: &Result<T, E>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where\n Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
","Ord","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> PartialEq for Result<T, E>
where\n T: PartialEq,\n E: PartialEq,

source§

fn eq(&self, other: &Result<T, E>) -> bool

This method tests for self and other values to be equal, and is used\nby ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always\nsufficient, and should not be overridden without very good reason.
","PartialEq","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> PartialOrd for Result<T, E>
where\n T: PartialOrd,\n E: PartialOrd,

source§

fn partial_cmp(&self, other: &Result<T, E>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <=\noperator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >=\noperator. Read more
","PartialOrd","cbor_smol::error::Result"],["
1.16.0 · source§

impl<T, U, E> Product<Result<U, E>> for Result<T, E>
where\n T: Product<U>,

source§

fn product<I>(iter: I) -> Result<T, E>
where\n I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err\noccur, the product of all elements is returned.

\n
§Examples
\n

This multiplies each number in a vector of strings,\nif a string could not be parsed the operation returns Err:

\n\n
let nums = vec![\"5\", \"10\", \"1\", \"2\"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert_eq!(total, Ok(100));\nlet nums = vec![\"5\", \"10\", \"one\", \"2\"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert!(total.is_err());
\n
","Product>","cbor_smol::error::Result"],["
source§

impl<T, E> Residual<T> for Result<Infallible, E>

§

type TryType = Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2_residual)
The “return” type of this meta-function.
","Residual","cbor_smol::error::Result"],["
source§

impl<T, E> Result<&T, E>

1.59.0 · source

pub fn copied(self) -> Result<T, E>
where\n T: Copy,

Maps a Result<&T, E> to a Result<T, E> by copying the contents of the\nOk part.

\n
§Examples
\n
let val = 12;\nlet x: Result<&i32, i32> = Ok(&val);\nassert_eq!(x, Ok(&12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
\n
1.59.0 · source

pub fn cloned(self) -> Result<T, E>
where\n T: Clone,

Maps a Result<&T, E> to a Result<T, E> by cloning the contents of the\nOk part.

\n
§Examples
\n
let val = 12;\nlet x: Result<&i32, i32> = Ok(&val);\nassert_eq!(x, Ok(&12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
\n
",0,"cbor_smol::error::Result"],["
source§

impl<T, E> Result<&mut T, E>

1.59.0 · source

pub fn copied(self) -> Result<T, E>
where\n T: Copy,

Maps a Result<&mut T, E> to a Result<T, E> by copying the contents of the\nOk part.

\n
§Examples
\n
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
\n
1.59.0 · source

pub fn cloned(self) -> Result<T, E>
where\n T: Clone,

Maps a Result<&mut T, E> to a Result<T, E> by cloning the contents of the\nOk part.

\n
§Examples
\n
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
\n
",0,"cbor_smol::error::Result"],["
source§

impl<T, E> Result<Option<T>, E>

1.33.0 (const: unstable) · source

pub fn transpose(self) -> Option<Result<T, E>>

Transposes a Result of an Option into an Option of a Result.

\n

Ok(None) will be mapped to None.\nOk(Some(_)) and Err(_) will be mapped to Some(Ok(_)) and Some(Err(_)).

\n
§Examples
\n
#[derive(Debug, Eq, PartialEq)]\nstruct SomeErr;\n\nlet x: Result<Option<i32>, SomeErr> = Ok(Some(5));\nlet y: Option<Result<i32, SomeErr>> = Some(Ok(5));\nassert_eq!(x.transpose(), y);
\n
",0,"cbor_smol::error::Result"],["
source§

impl<T, E> Result<Result<T, E>, E>

source

pub fn flatten(self) -> Result<T, E>

🔬This is a nightly-only experimental API. (result_flattening)

Converts from Result<Result<T, E>, E> to Result<T, E>

\n
§Examples
\n
#![feature(result_flattening)]\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Ok(\"hello\"));\nassert_eq!(Ok(\"hello\"), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Err(6));\nassert_eq!(Err(6), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Err(6);\nassert_eq!(Err(6), x.flatten());
\n

Flattening only removes one level of nesting at a time:

\n\n
#![feature(result_flattening)]\nlet x: Result<Result<Result<&'static str, u32>, u32>, u32> = Ok(Ok(Ok(\"hello\")));\nassert_eq!(Ok(Ok(\"hello\")), x.flatten());\nassert_eq!(Ok(\"hello\"), x.flatten().flatten());
\n
",0,"cbor_smol::error::Result"],["
source§

impl<T, E> Result<T, E>

1.0.0 (const: 1.48.0) · source

pub const fn is_ok(&self) -> bool

Returns true if the result is Ok.

\n
§Examples
\n
let x: Result<i32, &str> = Ok(-3);\nassert_eq!(x.is_ok(), true);\n\nlet x: Result<i32, &str> = Err(\"Some error message\");\nassert_eq!(x.is_ok(), false);
\n
1.70.0 · source

pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool

Returns true if the result is Ok and the value inside of it matches a predicate.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.is_ok_and(|x| x > 1), true);\n\nlet x: Result<u32, &str> = Ok(0);\nassert_eq!(x.is_ok_and(|x| x > 1), false);\n\nlet x: Result<u32, &str> = Err(\"hey\");\nassert_eq!(x.is_ok_and(|x| x > 1), false);
\n
1.0.0 (const: 1.48.0) · source

pub const fn is_err(&self) -> bool

Returns true if the result is Err.

\n
§Examples
\n
let x: Result<i32, &str> = Ok(-3);\nassert_eq!(x.is_err(), false);\n\nlet x: Result<i32, &str> = Err(\"Some error message\");\nassert_eq!(x.is_err(), true);
\n
1.70.0 · source

pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool

Returns true if the result is Err and the value inside of it matches a predicate.

\n
§Examples
\n
use std::io::{Error, ErrorKind};\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::NotFound, \"!\"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), true);\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::PermissionDenied, \"!\"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);\n\nlet x: Result<u32, Error> = Ok(123);\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);
\n
1.0.0 · source

pub fn ok(self) -> Option<T>

Converts from Result<T, E> to Option<T>.

\n

Converts self into an Option<T>, consuming self,\nand discarding the error, if any.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.ok(), Some(2));\n\nlet x: Result<u32, &str> = Err(\"Nothing here\");\nassert_eq!(x.ok(), None);
\n
1.0.0 · source

pub fn err(self) -> Option<E>

Converts from Result<T, E> to Option<E>.

\n

Converts self into an Option<E>, consuming self,\nand discarding the success value, if any.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.err(), None);\n\nlet x: Result<u32, &str> = Err(\"Nothing here\");\nassert_eq!(x.err(), Some(\"Nothing here\"));
\n
1.0.0 (const: 1.48.0) · source

pub const fn as_ref(&self) -> Result<&T, &E>

Converts from &Result<T, E> to Result<&T, &E>.

\n

Produces a new Result, containing a reference\ninto the original, leaving the original in place.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.as_ref(), Ok(&2));\n\nlet x: Result<u32, &str> = Err(\"Error\");\nassert_eq!(x.as_ref(), Err(&\"Error\"));
\n
1.0.0 (const: unstable) · source

pub fn as_mut(&mut self) -> Result<&mut T, &mut E>

Converts from &mut Result<T, E> to Result<&mut T, &mut E>.

\n
§Examples
\n
fn mutate(r: &mut Result<i32, i32>) {\n    match r.as_mut() {\n        Ok(v) => *v = 42,\n        Err(e) => *e = 0,\n    }\n}\n\nlet mut x: Result<i32, i32> = Ok(2);\nmutate(&mut x);\nassert_eq!(x.unwrap(), 42);\n\nlet mut x: Result<i32, i32> = Err(13);\nmutate(&mut x);\nassert_eq!(x.unwrap_err(), 0);
\n
1.0.0 · source

pub fn map<U, F>(self, op: F) -> Result<U, E>
where\n F: FnOnce(T) -> U,

Maps a Result<T, E> to Result<U, E> by applying a function to a\ncontained Ok value, leaving an Err value untouched.

\n

This function can be used to compose the results of two functions.

\n
§Examples
\n

Print the numbers on each line of a string multiplied by two.

\n\n
let line = \"1\\n2\\n3\\n4\\n\";\n\nfor num in line.lines() {\n    match num.parse::<i32>().map(|i| i * 2) {\n        Ok(n) => println!(\"{n}\"),\n        Err(..) => {}\n    }\n}
\n
1.41.0 · source

pub fn map_or<U, F>(self, default: U, f: F) -> U
where\n F: FnOnce(T) -> U,

Returns the provided default (if Err), or\napplies a function to the contained value (if Ok).

\n

Arguments passed to map_or are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use map_or_else,\nwhich is lazily evaluated.

\n
§Examples
\n
let x: Result<_, &str> = Ok(\"foo\");\nassert_eq!(x.map_or(42, |v| v.len()), 3);\n\nlet x: Result<&str, _> = Err(\"bar\");\nassert_eq!(x.map_or(42, |v| v.len()), 42);
\n
1.41.0 · source

pub fn map_or_else<U, D, F>(self, default: D, f: F) -> U
where\n D: FnOnce(E) -> U,\n F: FnOnce(T) -> U,

Maps a Result<T, E> to U by applying fallback function default to\na contained Err value, or function f to a contained Ok value.

\n

This function can be used to unpack a successful result\nwhile handling an error.

\n
§Examples
\n
let k = 21;\n\nlet x : Result<_, &str> = Ok(\"foo\");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 3);\n\nlet x : Result<&str, _> = Err(\"bar\");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 42);
\n
1.0.0 · source

pub fn map_err<F, O>(self, op: O) -> Result<T, F>
where\n O: FnOnce(E) -> F,

Maps a Result<T, E> to Result<T, F> by applying a function to a\ncontained Err value, leaving an Ok value untouched.

\n

This function can be used to pass through a successful result while handling\nan error.

\n
§Examples
\n
fn stringify(x: u32) -> String { format!(\"error code: {x}\") }\n\nlet x: Result<u32, u32> = Ok(2);\nassert_eq!(x.map_err(stringify), Ok(2));\n\nlet x: Result<u32, u32> = Err(13);\nassert_eq!(x.map_err(stringify), Err(\"error code: 13\".to_string()));
\n
1.76.0 · source

pub fn inspect<F>(self, f: F) -> Result<T, E>
where\n F: FnOnce(&T),

Calls a function with a reference to the contained value if Ok.

\n

Returns the original result.

\n
§Examples
\n
let x: u8 = \"4\"\n    .parse::<u8>()\n    .inspect(|x| println!(\"original: {x}\"))\n    .map(|x| x.pow(3))\n    .expect(\"failed to parse number\");
\n
1.76.0 · source

pub fn inspect_err<F>(self, f: F) -> Result<T, E>
where\n F: FnOnce(&E),

Calls a function with a reference to the contained value if Err.

\n

Returns the original result.

\n
§Examples
\n
use std::{fs, io};\n\nfn read() -> io::Result<String> {\n    fs::read_to_string(\"address.txt\")\n        .inspect_err(|e| eprintln!(\"failed to read file: {e}\"))\n}
\n
1.47.0 · source

pub fn as_deref(&self) -> Result<&<T as Deref>::Target, &E>
where\n T: Deref,

Converts from Result<T, E> (or &Result<T, E>) to Result<&<T as Deref>::Target, &E>.

\n

Coerces the Ok variant of the original Result via Deref\nand returns the new Result.

\n
§Examples
\n
let x: Result<String, u32> = Ok(\"hello\".to_string());\nlet y: Result<&str, &u32> = Ok(\"hello\");\nassert_eq!(x.as_deref(), y);\n\nlet x: Result<String, u32> = Err(42);\nlet y: Result<&str, &u32> = Err(&42);\nassert_eq!(x.as_deref(), y);
\n
1.47.0 · source

pub fn as_deref_mut(&mut self) -> Result<&mut <T as Deref>::Target, &mut E>
where\n T: DerefMut,

Converts from Result<T, E> (or &mut Result<T, E>) to Result<&mut <T as DerefMut>::Target, &mut E>.

\n

Coerces the Ok variant of the original Result via DerefMut\nand returns the new Result.

\n
§Examples
\n
let mut s = \"HELLO\".to_string();\nlet mut x: Result<String, u32> = Ok(\"hello\".to_string());\nlet y: Result<&mut str, &mut u32> = Ok(&mut s);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);\n\nlet mut i = 42;\nlet mut x: Result<String, u32> = Err(42);\nlet y: Result<&mut str, &mut u32> = Err(&mut i);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
\n
1.0.0 · source

pub fn iter(&self) -> Iter<'_, T>

Returns an iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(7);\nassert_eq!(x.iter().next(), Some(&7));\n\nlet x: Result<u32, &str> = Err(\"nothing!\");\nassert_eq!(x.iter().next(), None);
\n
1.0.0 · source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns a mutable iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
§Examples
\n
let mut x: Result<u32, &str> = Ok(7);\nmatch x.iter_mut().next() {\n    Some(v) => *v = 40,\n    None => {},\n}\nassert_eq!(x, Ok(40));\n\nlet mut x: Result<u32, &str> = Err(\"nothing!\");\nassert_eq!(x.iter_mut().next(), None);
\n
1.4.0 · source

pub fn expect(self, msg: &str) -> T
where\n E: Debug,

Returns the contained Ok value, consuming the self value.

\n

Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err\ncase explicitly, or call unwrap_or, unwrap_or_else, or\nunwrap_or_default.

\n
§Panics
\n

Panics if the value is an Err, with a panic message including the\npassed message, and the content of the Err.

\n
§Examples
\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nx.expect(\"Testing expect\"); // panics with `Testing expect: emergency failure`
\n
§Recommended Message Style
\n

We recommend that expect messages are used to describe the reason you\nexpect the Result should be Ok.

\n\n
let path = std::env::var(\"IMPORTANT_PATH\")\n    .expect(\"env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`\");
\n

Hint: If you’re having trouble remembering how to phrase expect\nerror messages remember to focus on the word “should” as in “env\nvariable should be set by blah” or “the given binary should be available\nand executable by the current user”.

\n

For more detail on expect message styles and the reasoning behind our recommendation please\nrefer to the section on “Common Message\nStyles” in the\nstd::error module docs.

\n
1.0.0 · source

pub fn unwrap(self) -> T
where\n E: Debug,

Returns the contained Ok value, consuming the self value.

\n

Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err\ncase explicitly, or call unwrap_or, unwrap_or_else, or\nunwrap_or_default.

\n
§Panics
\n

Panics if the value is an Err, with a panic message provided by the\nErr’s value.

\n
§Examples
\n

Basic usage:

\n\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.unwrap(), 2);
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nx.unwrap(); // panics with `emergency failure`
\n
1.16.0 · source

pub fn unwrap_or_default(self) -> T
where\n T: Default,

Returns the contained Ok value or a default

\n

Consumes the self argument then, if Ok, returns the contained\nvalue, otherwise if Err, returns the default value for that\ntype.

\n
§Examples
\n

Converts a string to an integer, turning poorly-formed strings\ninto 0 (the default value for integers). parse converts\na string to any other type that implements FromStr, returning an\nErr on error.

\n\n
let good_year_from_input = \"1909\";\nlet bad_year_from_input = \"190blarg\";\nlet good_year = good_year_from_input.parse().unwrap_or_default();\nlet bad_year = bad_year_from_input.parse().unwrap_or_default();\n\nassert_eq!(1909, good_year);\nassert_eq!(0, bad_year);
\n
1.17.0 · source

pub fn expect_err(self, msg: &str) -> E
where\n T: Debug,

Returns the contained Err value, consuming the self value.

\n
§Panics
\n

Panics if the value is an Ok, with a panic message including the\npassed message, and the content of the Ok.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(10);\nx.expect_err(\"Testing expect_err\"); // panics with `Testing expect_err: 10`
\n
1.0.0 · source

pub fn unwrap_err(self) -> E
where\n T: Debug,

Returns the contained Err value, consuming the self value.

\n
§Panics
\n

Panics if the value is an Ok, with a custom panic message provided\nby the Ok’s value.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nx.unwrap_err(); // panics with `2`
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nassert_eq!(x.unwrap_err(), \"emergency failure\");
\n
source

pub fn into_ok(self) -> T
where\n E: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Ok value, but never panics.

\n

Unlike unwrap, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap as a maintainability safeguard that will fail\nto compile if the error type of the Result is later changed\nto an error that can actually occur.

\n
§Examples
\n
\nfn only_good_news() -> Result<String, !> {\n    Ok(\"this is fine\".into())\n}\n\nlet s: String = only_good_news().into_ok();\nprintln!(\"{s}\");
\n
source

pub fn into_err(self) -> E
where\n T: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Err value, but never panics.

\n

Unlike unwrap_err, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap_err as a maintainability safeguard that will fail\nto compile if the ok type of the Result is later changed\nto a type that can actually occur.

\n
§Examples
\n
\nfn only_bad_news() -> Result<!, String> {\n    Err(\"Oops, it failed\".into())\n}\n\nlet error: String = only_bad_news().into_err();\nprintln!(\"{error}\");
\n
1.0.0 · source

pub fn and<U>(self, res: Result<U, E>) -> Result<U, E>

Returns res if the result is Ok, otherwise returns the Err value of self.

\n

Arguments passed to and are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use and_then, which is\nlazily evaluated.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Err(\"late error\");\nassert_eq!(x.and(y), Err(\"late error\"));\n\nlet x: Result<u32, &str> = Err(\"early error\");\nlet y: Result<&str, &str> = Ok(\"foo\");\nassert_eq!(x.and(y), Err(\"early error\"));\n\nlet x: Result<u32, &str> = Err(\"not a 2\");\nlet y: Result<&str, &str> = Err(\"late error\");\nassert_eq!(x.and(y), Err(\"not a 2\"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Ok(\"different result type\");\nassert_eq!(x.and(y), Ok(\"different result type\"));
\n
1.0.0 · source

pub fn and_then<U, F>(self, op: F) -> Result<U, E>
where\n F: FnOnce(T) -> Result<U, E>,

Calls op if the result is Ok, otherwise returns the Err value of self.

\n

This function can be used for control flow based on Result values.

\n
§Examples
\n
fn sq_then_to_string(x: u32) -> Result<String, &'static str> {\n    x.checked_mul(x).map(|sq| sq.to_string()).ok_or(\"overflowed\")\n}\n\nassert_eq!(Ok(2).and_then(sq_then_to_string), Ok(4.to_string()));\nassert_eq!(Ok(1_000_000).and_then(sq_then_to_string), Err(\"overflowed\"));\nassert_eq!(Err(\"not a number\").and_then(sq_then_to_string), Err(\"not a number\"));
\n

Often used to chain fallible operations that may return Err.

\n\n
use std::{io::ErrorKind, path::Path};\n\n// Note: on Windows \"/\" maps to \"C:\\\"\nlet root_modified_time = Path::new(\"/\").metadata().and_then(|md| md.modified());\nassert!(root_modified_time.is_ok());\n\nlet should_fail = Path::new(\"/bad/path\").metadata().and_then(|md| md.modified());\nassert!(should_fail.is_err());\nassert_eq!(should_fail.unwrap_err().kind(), ErrorKind::NotFound);
\n
1.0.0 · source

pub fn or<F>(self, res: Result<T, F>) -> Result<T, F>

Returns res if the result is Err, otherwise returns the Ok value of self.

\n

Arguments passed to or are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use or_else, which is\nlazily evaluated.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Err(\"late error\");\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err(\"early error\");\nlet y: Result<u32, &str> = Ok(2);\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err(\"not a 2\");\nlet y: Result<u32, &str> = Err(\"late error\");\nassert_eq!(x.or(y), Err(\"late error\"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Ok(100);\nassert_eq!(x.or(y), Ok(2));
\n
1.0.0 · source

pub fn or_else<F, O>(self, op: O) -> Result<T, F>
where\n O: FnOnce(E) -> Result<T, F>,

Calls op if the result is Err, otherwise returns the Ok value of self.

\n

This function can be used for control flow based on result values.

\n
§Examples
\n
fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }\nfn err(x: u32) -> Result<u32, u32> { Err(x) }\n\nassert_eq!(Ok(2).or_else(sq).or_else(sq), Ok(2));\nassert_eq!(Ok(2).or_else(err).or_else(sq), Ok(2));\nassert_eq!(Err(3).or_else(sq).or_else(err), Ok(9));\nassert_eq!(Err(3).or_else(err).or_else(err), Err(3));
\n
1.0.0 · source

pub fn unwrap_or(self, default: T) -> T

Returns the contained Ok value or a provided default.

\n

Arguments passed to unwrap_or are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use unwrap_or_else,\nwhich is lazily evaluated.

\n
§Examples
\n
let default = 2;\nlet x: Result<u32, &str> = Ok(9);\nassert_eq!(x.unwrap_or(default), 9);\n\nlet x: Result<u32, &str> = Err(\"error\");\nassert_eq!(x.unwrap_or(default), default);
\n
1.0.0 · source

pub fn unwrap_or_else<F>(self, op: F) -> T
where\n F: FnOnce(E) -> T,

Returns the contained Ok value or computes it from a closure.

\n
§Examples
\n
fn count(x: &str) -> usize { x.len() }\n\nassert_eq!(Ok(2).unwrap_or_else(count), 2);\nassert_eq!(Err(\"foo\").unwrap_or_else(count), 3);
\n
1.58.0 · source

pub unsafe fn unwrap_unchecked(self) -> T

Returns the contained Ok value, consuming the self value,\nwithout checking that the value is not an Err.

\n
§Safety
\n

Calling this method on an Err is undefined behavior.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(unsafe { x.unwrap_unchecked() }, 2);
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nunsafe { x.unwrap_unchecked(); } // Undefined behavior!
\n
1.58.0 · source

pub unsafe fn unwrap_err_unchecked(self) -> E

Returns the contained Err value, consuming the self value,\nwithout checking that the value is not an Ok.

\n
§Safety
\n

Calling this method on an Ok is undefined behavior.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nunsafe { x.unwrap_err_unchecked() }; // Undefined behavior!
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nassert_eq!(unsafe { x.unwrap_err_unchecked() }, \"emergency failure\");
\n
",0,"cbor_smol::error::Result"],["
source§

impl<T, E> Serialize for Result<T, E>
where\n T: Serialize,\n E: Serialize,

source§

fn serialize<S>(\n &self,\n serializer: S,\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where\n S: Serializer,

Serialize this value into the given Serde serializer. Read more
","Serialize","cbor_smol::error::Result"],["
1.16.0 · source§

impl<T, U, E> Sum<Result<U, E>> for Result<T, E>
where\n T: Sum<U>,

source§

fn sum<I>(iter: I) -> Result<T, E>
where\n I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err\noccur, the sum of all elements is returned.

\n
§Examples
\n

This sums up every integer in a vector, rejecting the sum if a negative\nelement is encountered:

\n\n
let f = |&x: &i32| if x < 0 { Err(\"Negative element found\") } else { Ok(x) };\nlet v = vec![1, 2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Ok(3));\nlet v = vec![1, -2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Err(\"Negative element found\"));
\n
","Sum>","cbor_smol::error::Result"],["
source§

impl<T, E> Try for Result<T, E>

§

type Output = T

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value produced by ? when not short-circuiting.
§

type Residual = Result<Infallible, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value passed to FromResidual::from_residual\nas part of ? when short-circuiting. Read more
source§

fn from_output(output: <Result<T, E> as Try>::Output) -> Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from its Output type. Read more
source§

fn branch(\n self,\n) -> ControlFlow<<Result<T, E> as Try>::Residual, <Result<T, E> as Try>::Output>

🔬This is a nightly-only experimental API. (try_trait_v2)
Used in ? to decide whether the operator should produce a value\n(because this returned ControlFlow::Continue)\nor propagate a value back to the caller\n(because this returned ControlFlow::Break). Read more
","Try","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> Copy for Result<T, E>
where\n T: Copy,\n E: Copy,

","Copy","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> Eq for Result<T, E>
where\n T: Eq,\n E: Eq,

","Eq","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> StructuralPartialEq for Result<T, E>

","StructuralPartialEq","cbor_smol::error::Result"]] +"cbor_smol":[["
1.0.0 · source§

impl<T, E> Clone for Result<T, E>
where\n T: Clone,\n E: Clone,

source§

fn clone(&self) -> Result<T, E>

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &Result<T, E>)

Performs copy-assignment from source. Read more
","Clone","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> Debug for Result<T, E>
where\n T: Debug,\n E: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","cbor_smol::error::Result"],["
source§

impl<'de, T, E> Deserialize<'de> for Result<T, E>
where\n T: Deserialize<'de>,\n E: Deserialize<'de>,

source§

fn deserialize<D>(\n deserializer: D,\n) -> Result<Result<T, E>, <D as Deserializer<'de>>::Error>
where\n D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
","Deserialize<'de>","cbor_smol::error::Result"],["
1.0.0 · source§

impl<A, E, V> FromIterator<Result<A, E>> for Result<V, E>
where\n V: FromIterator<A>,

source§

fn from_iter<I>(iter: I) -> Result<V, E>
where\n I: IntoIterator<Item = Result<A, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err occur, a\ncontainer with the values of each Result is returned.

\n

Here is an example which increments every integer in a vector,\nchecking for overflow:

\n\n
let v = vec![1, 2];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n    x.checked_add(1).ok_or(\"Overflow!\")\n).collect();\nassert_eq!(res, Ok(vec![2, 3]));
\n

Here is another example that tries to subtract one from another list\nof integers, this time checking for underflow:

\n\n
let v = vec![1, 2, 0];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n    x.checked_sub(1).ok_or(\"Underflow!\")\n).collect();\nassert_eq!(res, Err(\"Underflow!\"));
\n

Here is a variation on the previous example, showing that no\nfurther elements are taken from iter after the first Err.

\n\n
let v = vec![3, 2, 1, 10];\nlet mut shared = 0;\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32| {\n    shared += x;\n    x.checked_sub(2).ok_or(\"Underflow!\")\n}).collect();\nassert_eq!(res, Err(\"Underflow!\"));\nassert_eq!(shared, 6);
\n

Since the third element caused an underflow, no further elements were taken,\nso the final value of shared is 6 (= 3 + 2 + 1), not 16.

\n
","FromIterator>","cbor_smol::error::Result"],["
source§

impl<T, E, F> FromResidual<Result<Infallible, E>> for Result<T, F>
where\n F: From<E>,

source§

fn from_residual(residual: Result<Infallible, E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
","FromResidual>","cbor_smol::error::Result"],["
source§

impl<T, E, F> FromResidual<Yeet<E>> for Result<T, F>
where\n F: From<E>,

source§

fn from_residual(_: Yeet<E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
","FromResidual>","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> Hash for Result<T, E>
where\n T: Hash,\n E: Hash,

source§

fn hash<__H>(&self, state: &mut __H)
where\n __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where\n H: Hasher,\n Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
","Hash","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> IntoIterator for Result<T, E>

source§

fn into_iter(self) -> IntoIter<T>

Returns a consuming iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(5);\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, [5]);\n\nlet x: Result<u32, &str> = Err(\"nothing!\");\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, []);
\n
§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
","IntoIterator","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> Ord for Result<T, E>
where\n T: Ord,\n E: Ord,

source§

fn cmp(&self, other: &Result<T, E>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where\n Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
","Ord","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> PartialEq for Result<T, E>
where\n T: PartialEq,\n E: PartialEq,

source§

fn eq(&self, other: &Result<T, E>) -> bool

This method tests for self and other values to be equal, and is used\nby ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always\nsufficient, and should not be overridden without very good reason.
","PartialEq","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> PartialOrd for Result<T, E>
where\n T: PartialOrd,\n E: PartialOrd,

source§

fn partial_cmp(&self, other: &Result<T, E>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <=\noperator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >=\noperator. Read more
","PartialOrd","cbor_smol::error::Result"],["
1.16.0 · source§

impl<T, U, E> Product<Result<U, E>> for Result<T, E>
where\n T: Product<U>,

source§

fn product<I>(iter: I) -> Result<T, E>
where\n I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err\noccur, the product of all elements is returned.

\n
§Examples
\n

This multiplies each number in a vector of strings,\nif a string could not be parsed the operation returns Err:

\n\n
let nums = vec![\"5\", \"10\", \"1\", \"2\"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert_eq!(total, Ok(100));\nlet nums = vec![\"5\", \"10\", \"one\", \"2\"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert!(total.is_err());
\n
","Product>","cbor_smol::error::Result"],["
source§

impl<T, E> Residual<T> for Result<Infallible, E>

§

type TryType = Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2_residual)
The “return” type of this meta-function.
","Residual","cbor_smol::error::Result"],["
source§

impl<T, E> Result<&T, E>

1.59.0 · source

pub fn copied(self) -> Result<T, E>
where\n T: Copy,

Maps a Result<&T, E> to a Result<T, E> by copying the contents of the\nOk part.

\n
§Examples
\n
let val = 12;\nlet x: Result<&i32, i32> = Ok(&val);\nassert_eq!(x, Ok(&12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
\n
1.59.0 · source

pub fn cloned(self) -> Result<T, E>
where\n T: Clone,

Maps a Result<&T, E> to a Result<T, E> by cloning the contents of the\nOk part.

\n
§Examples
\n
let val = 12;\nlet x: Result<&i32, i32> = Ok(&val);\nassert_eq!(x, Ok(&12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
\n
",0,"cbor_smol::error::Result"],["
source§

impl<T, E> Result<&mut T, E>

1.59.0 · source

pub fn copied(self) -> Result<T, E>
where\n T: Copy,

Maps a Result<&mut T, E> to a Result<T, E> by copying the contents of the\nOk part.

\n
§Examples
\n
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
\n
1.59.0 · source

pub fn cloned(self) -> Result<T, E>
where\n T: Clone,

Maps a Result<&mut T, E> to a Result<T, E> by cloning the contents of the\nOk part.

\n
§Examples
\n
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
\n
",0,"cbor_smol::error::Result"],["
source§

impl<T, E> Result<Option<T>, E>

1.33.0 (const: unstable) · source

pub fn transpose(self) -> Option<Result<T, E>>

Transposes a Result of an Option into an Option of a Result.

\n

Ok(None) will be mapped to None.\nOk(Some(_)) and Err(_) will be mapped to Some(Ok(_)) and Some(Err(_)).

\n
§Examples
\n
#[derive(Debug, Eq, PartialEq)]\nstruct SomeErr;\n\nlet x: Result<Option<i32>, SomeErr> = Ok(Some(5));\nlet y: Option<Result<i32, SomeErr>> = Some(Ok(5));\nassert_eq!(x.transpose(), y);
\n
",0,"cbor_smol::error::Result"],["
source§

impl<T, E> Result<Result<T, E>, E>

source

pub fn flatten(self) -> Result<T, E>

🔬This is a nightly-only experimental API. (result_flattening)

Converts from Result<Result<T, E>, E> to Result<T, E>

\n
§Examples
\n
#![feature(result_flattening)]\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Ok(\"hello\"));\nassert_eq!(Ok(\"hello\"), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Err(6));\nassert_eq!(Err(6), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Err(6);\nassert_eq!(Err(6), x.flatten());
\n

Flattening only removes one level of nesting at a time:

\n\n
#![feature(result_flattening)]\nlet x: Result<Result<Result<&'static str, u32>, u32>, u32> = Ok(Ok(Ok(\"hello\")));\nassert_eq!(Ok(Ok(\"hello\")), x.flatten());\nassert_eq!(Ok(\"hello\"), x.flatten().flatten());
\n
",0,"cbor_smol::error::Result"],["
source§

impl<T, E> Result<T, E>

1.0.0 (const: 1.48.0) · source

pub const fn is_ok(&self) -> bool

Returns true if the result is Ok.

\n
§Examples
\n
let x: Result<i32, &str> = Ok(-3);\nassert_eq!(x.is_ok(), true);\n\nlet x: Result<i32, &str> = Err(\"Some error message\");\nassert_eq!(x.is_ok(), false);
\n
1.70.0 · source

pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool

Returns true if the result is Ok and the value inside of it matches a predicate.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.is_ok_and(|x| x > 1), true);\n\nlet x: Result<u32, &str> = Ok(0);\nassert_eq!(x.is_ok_and(|x| x > 1), false);\n\nlet x: Result<u32, &str> = Err(\"hey\");\nassert_eq!(x.is_ok_and(|x| x > 1), false);
\n
1.0.0 (const: 1.48.0) · source

pub const fn is_err(&self) -> bool

Returns true if the result is Err.

\n
§Examples
\n
let x: Result<i32, &str> = Ok(-3);\nassert_eq!(x.is_err(), false);\n\nlet x: Result<i32, &str> = Err(\"Some error message\");\nassert_eq!(x.is_err(), true);
\n
1.70.0 · source

pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool

Returns true if the result is Err and the value inside of it matches a predicate.

\n
§Examples
\n
use std::io::{Error, ErrorKind};\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::NotFound, \"!\"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), true);\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::PermissionDenied, \"!\"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);\n\nlet x: Result<u32, Error> = Ok(123);\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);
\n
1.0.0 · source

pub fn ok(self) -> Option<T>

Converts from Result<T, E> to Option<T>.

\n

Converts self into an Option<T>, consuming self,\nand discarding the error, if any.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.ok(), Some(2));\n\nlet x: Result<u32, &str> = Err(\"Nothing here\");\nassert_eq!(x.ok(), None);
\n
1.0.0 · source

pub fn err(self) -> Option<E>

Converts from Result<T, E> to Option<E>.

\n

Converts self into an Option<E>, consuming self,\nand discarding the success value, if any.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.err(), None);\n\nlet x: Result<u32, &str> = Err(\"Nothing here\");\nassert_eq!(x.err(), Some(\"Nothing here\"));
\n
1.0.0 (const: 1.48.0) · source

pub const fn as_ref(&self) -> Result<&T, &E>

Converts from &Result<T, E> to Result<&T, &E>.

\n

Produces a new Result, containing a reference\ninto the original, leaving the original in place.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.as_ref(), Ok(&2));\n\nlet x: Result<u32, &str> = Err(\"Error\");\nassert_eq!(x.as_ref(), Err(&\"Error\"));
\n
1.0.0 (const: unstable) · source

pub fn as_mut(&mut self) -> Result<&mut T, &mut E>

Converts from &mut Result<T, E> to Result<&mut T, &mut E>.

\n
§Examples
\n
fn mutate(r: &mut Result<i32, i32>) {\n    match r.as_mut() {\n        Ok(v) => *v = 42,\n        Err(e) => *e = 0,\n    }\n}\n\nlet mut x: Result<i32, i32> = Ok(2);\nmutate(&mut x);\nassert_eq!(x.unwrap(), 42);\n\nlet mut x: Result<i32, i32> = Err(13);\nmutate(&mut x);\nassert_eq!(x.unwrap_err(), 0);
\n
1.0.0 · source

pub fn map<U, F>(self, op: F) -> Result<U, E>
where\n F: FnOnce(T) -> U,

Maps a Result<T, E> to Result<U, E> by applying a function to a\ncontained Ok value, leaving an Err value untouched.

\n

This function can be used to compose the results of two functions.

\n
§Examples
\n

Print the numbers on each line of a string multiplied by two.

\n\n
let line = \"1\\n2\\n3\\n4\\n\";\n\nfor num in line.lines() {\n    match num.parse::<i32>().map(|i| i * 2) {\n        Ok(n) => println!(\"{n}\"),\n        Err(..) => {}\n    }\n}
\n
1.41.0 · source

pub fn map_or<U, F>(self, default: U, f: F) -> U
where\n F: FnOnce(T) -> U,

Returns the provided default (if Err), or\napplies a function to the contained value (if Ok).

\n

Arguments passed to map_or are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use map_or_else,\nwhich is lazily evaluated.

\n
§Examples
\n
let x: Result<_, &str> = Ok(\"foo\");\nassert_eq!(x.map_or(42, |v| v.len()), 3);\n\nlet x: Result<&str, _> = Err(\"bar\");\nassert_eq!(x.map_or(42, |v| v.len()), 42);
\n
1.41.0 · source

pub fn map_or_else<U, D, F>(self, default: D, f: F) -> U
where\n D: FnOnce(E) -> U,\n F: FnOnce(T) -> U,

Maps a Result<T, E> to U by applying fallback function default to\na contained Err value, or function f to a contained Ok value.

\n

This function can be used to unpack a successful result\nwhile handling an error.

\n
§Examples
\n
let k = 21;\n\nlet x : Result<_, &str> = Ok(\"foo\");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 3);\n\nlet x : Result<&str, _> = Err(\"bar\");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 42);
\n
1.0.0 · source

pub fn map_err<F, O>(self, op: O) -> Result<T, F>
where\n O: FnOnce(E) -> F,

Maps a Result<T, E> to Result<T, F> by applying a function to a\ncontained Err value, leaving an Ok value untouched.

\n

This function can be used to pass through a successful result while handling\nan error.

\n
§Examples
\n
fn stringify(x: u32) -> String { format!(\"error code: {x}\") }\n\nlet x: Result<u32, u32> = Ok(2);\nassert_eq!(x.map_err(stringify), Ok(2));\n\nlet x: Result<u32, u32> = Err(13);\nassert_eq!(x.map_err(stringify), Err(\"error code: 13\".to_string()));
\n
1.76.0 · source

pub fn inspect<F>(self, f: F) -> Result<T, E>
where\n F: FnOnce(&T),

Calls a function with a reference to the contained value if Ok.

\n

Returns the original result.

\n
§Examples
\n
let x: u8 = \"4\"\n    .parse::<u8>()\n    .inspect(|x| println!(\"original: {x}\"))\n    .map(|x| x.pow(3))\n    .expect(\"failed to parse number\");
\n
1.76.0 · source

pub fn inspect_err<F>(self, f: F) -> Result<T, E>
where\n F: FnOnce(&E),

Calls a function with a reference to the contained value if Err.

\n

Returns the original result.

\n
§Examples
\n
use std::{fs, io};\n\nfn read() -> io::Result<String> {\n    fs::read_to_string(\"address.txt\")\n        .inspect_err(|e| eprintln!(\"failed to read file: {e}\"))\n}
\n
1.47.0 · source

pub fn as_deref(&self) -> Result<&<T as Deref>::Target, &E>
where\n T: Deref,

Converts from Result<T, E> (or &Result<T, E>) to Result<&<T as Deref>::Target, &E>.

\n

Coerces the Ok variant of the original Result via Deref\nand returns the new Result.

\n
§Examples
\n
let x: Result<String, u32> = Ok(\"hello\".to_string());\nlet y: Result<&str, &u32> = Ok(\"hello\");\nassert_eq!(x.as_deref(), y);\n\nlet x: Result<String, u32> = Err(42);\nlet y: Result<&str, &u32> = Err(&42);\nassert_eq!(x.as_deref(), y);
\n
1.47.0 · source

pub fn as_deref_mut(&mut self) -> Result<&mut <T as Deref>::Target, &mut E>
where\n T: DerefMut,

Converts from Result<T, E> (or &mut Result<T, E>) to Result<&mut <T as DerefMut>::Target, &mut E>.

\n

Coerces the Ok variant of the original Result via DerefMut\nand returns the new Result.

\n
§Examples
\n
let mut s = \"HELLO\".to_string();\nlet mut x: Result<String, u32> = Ok(\"hello\".to_string());\nlet y: Result<&mut str, &mut u32> = Ok(&mut s);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);\n\nlet mut i = 42;\nlet mut x: Result<String, u32> = Err(42);\nlet y: Result<&mut str, &mut u32> = Err(&mut i);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
\n
1.0.0 · source

pub fn iter(&self) -> Iter<'_, T>

Returns an iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(7);\nassert_eq!(x.iter().next(), Some(&7));\n\nlet x: Result<u32, &str> = Err(\"nothing!\");\nassert_eq!(x.iter().next(), None);
\n
1.0.0 · source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns a mutable iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
§Examples
\n
let mut x: Result<u32, &str> = Ok(7);\nmatch x.iter_mut().next() {\n    Some(v) => *v = 40,\n    None => {},\n}\nassert_eq!(x, Ok(40));\n\nlet mut x: Result<u32, &str> = Err(\"nothing!\");\nassert_eq!(x.iter_mut().next(), None);
\n
1.4.0 · source

pub fn expect(self, msg: &str) -> T
where\n E: Debug,

Returns the contained Ok value, consuming the self value.

\n

Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err\ncase explicitly, or call unwrap_or, unwrap_or_else, or\nunwrap_or_default.

\n
§Panics
\n

Panics if the value is an Err, with a panic message including the\npassed message, and the content of the Err.

\n
§Examples
\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nx.expect(\"Testing expect\"); // panics with `Testing expect: emergency failure`
\n
§Recommended Message Style
\n

We recommend that expect messages are used to describe the reason you\nexpect the Result should be Ok.

\n\n
let path = std::env::var(\"IMPORTANT_PATH\")\n    .expect(\"env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`\");
\n

Hint: If you’re having trouble remembering how to phrase expect\nerror messages remember to focus on the word “should” as in “env\nvariable should be set by blah” or “the given binary should be available\nand executable by the current user”.

\n

For more detail on expect message styles and the reasoning behind our recommendation please\nrefer to the section on “Common Message\nStyles” in the\nstd::error module docs.

\n
1.0.0 · source

pub fn unwrap(self) -> T
where\n E: Debug,

Returns the contained Ok value, consuming the self value.

\n

Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err\ncase explicitly, or call unwrap_or, unwrap_or_else, or\nunwrap_or_default.

\n
§Panics
\n

Panics if the value is an Err, with a panic message provided by the\nErr’s value.

\n
§Examples
\n

Basic usage:

\n\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.unwrap(), 2);
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nx.unwrap(); // panics with `emergency failure`
\n
1.16.0 · source

pub fn unwrap_or_default(self) -> T
where\n T: Default,

Returns the contained Ok value or a default

\n

Consumes the self argument then, if Ok, returns the contained\nvalue, otherwise if Err, returns the default value for that\ntype.

\n
§Examples
\n

Converts a string to an integer, turning poorly-formed strings\ninto 0 (the default value for integers). parse converts\na string to any other type that implements FromStr, returning an\nErr on error.

\n\n
let good_year_from_input = \"1909\";\nlet bad_year_from_input = \"190blarg\";\nlet good_year = good_year_from_input.parse().unwrap_or_default();\nlet bad_year = bad_year_from_input.parse().unwrap_or_default();\n\nassert_eq!(1909, good_year);\nassert_eq!(0, bad_year);
\n
1.17.0 · source

pub fn expect_err(self, msg: &str) -> E
where\n T: Debug,

Returns the contained Err value, consuming the self value.

\n
§Panics
\n

Panics if the value is an Ok, with a panic message including the\npassed message, and the content of the Ok.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(10);\nx.expect_err(\"Testing expect_err\"); // panics with `Testing expect_err: 10`
\n
1.0.0 · source

pub fn unwrap_err(self) -> E
where\n T: Debug,

Returns the contained Err value, consuming the self value.

\n
§Panics
\n

Panics if the value is an Ok, with a custom panic message provided\nby the Ok’s value.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nx.unwrap_err(); // panics with `2`
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nassert_eq!(x.unwrap_err(), \"emergency failure\");
\n
source

pub fn into_ok(self) -> T
where\n E: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Ok value, but never panics.

\n

Unlike unwrap, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap as a maintainability safeguard that will fail\nto compile if the error type of the Result is later changed\nto an error that can actually occur.

\n
§Examples
\n
\nfn only_good_news() -> Result<String, !> {\n    Ok(\"this is fine\".into())\n}\n\nlet s: String = only_good_news().into_ok();\nprintln!(\"{s}\");
\n
source

pub fn into_err(self) -> E
where\n T: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Err value, but never panics.

\n

Unlike unwrap_err, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap_err as a maintainability safeguard that will fail\nto compile if the ok type of the Result is later changed\nto a type that can actually occur.

\n
§Examples
\n
\nfn only_bad_news() -> Result<!, String> {\n    Err(\"Oops, it failed\".into())\n}\n\nlet error: String = only_bad_news().into_err();\nprintln!(\"{error}\");
\n
1.0.0 · source

pub fn and<U>(self, res: Result<U, E>) -> Result<U, E>

Returns res if the result is Ok, otherwise returns the Err value of self.

\n

Arguments passed to and are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use and_then, which is\nlazily evaluated.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Err(\"late error\");\nassert_eq!(x.and(y), Err(\"late error\"));\n\nlet x: Result<u32, &str> = Err(\"early error\");\nlet y: Result<&str, &str> = Ok(\"foo\");\nassert_eq!(x.and(y), Err(\"early error\"));\n\nlet x: Result<u32, &str> = Err(\"not a 2\");\nlet y: Result<&str, &str> = Err(\"late error\");\nassert_eq!(x.and(y), Err(\"not a 2\"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Ok(\"different result type\");\nassert_eq!(x.and(y), Ok(\"different result type\"));
\n
1.0.0 · source

pub fn and_then<U, F>(self, op: F) -> Result<U, E>
where\n F: FnOnce(T) -> Result<U, E>,

Calls op if the result is Ok, otherwise returns the Err value of self.

\n

This function can be used for control flow based on Result values.

\n
§Examples
\n
fn sq_then_to_string(x: u32) -> Result<String, &'static str> {\n    x.checked_mul(x).map(|sq| sq.to_string()).ok_or(\"overflowed\")\n}\n\nassert_eq!(Ok(2).and_then(sq_then_to_string), Ok(4.to_string()));\nassert_eq!(Ok(1_000_000).and_then(sq_then_to_string), Err(\"overflowed\"));\nassert_eq!(Err(\"not a number\").and_then(sq_then_to_string), Err(\"not a number\"));
\n

Often used to chain fallible operations that may return Err.

\n\n
use std::{io::ErrorKind, path::Path};\n\n// Note: on Windows \"/\" maps to \"C:\\\"\nlet root_modified_time = Path::new(\"/\").metadata().and_then(|md| md.modified());\nassert!(root_modified_time.is_ok());\n\nlet should_fail = Path::new(\"/bad/path\").metadata().and_then(|md| md.modified());\nassert!(should_fail.is_err());\nassert_eq!(should_fail.unwrap_err().kind(), ErrorKind::NotFound);
\n
1.0.0 · source

pub fn or<F>(self, res: Result<T, F>) -> Result<T, F>

Returns res if the result is Err, otherwise returns the Ok value of self.

\n

Arguments passed to or are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use or_else, which is\nlazily evaluated.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Err(\"late error\");\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err(\"early error\");\nlet y: Result<u32, &str> = Ok(2);\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err(\"not a 2\");\nlet y: Result<u32, &str> = Err(\"late error\");\nassert_eq!(x.or(y), Err(\"late error\"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Ok(100);\nassert_eq!(x.or(y), Ok(2));
\n
1.0.0 · source

pub fn or_else<F, O>(self, op: O) -> Result<T, F>
where\n O: FnOnce(E) -> Result<T, F>,

Calls op if the result is Err, otherwise returns the Ok value of self.

\n

This function can be used for control flow based on result values.

\n
§Examples
\n
fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }\nfn err(x: u32) -> Result<u32, u32> { Err(x) }\n\nassert_eq!(Ok(2).or_else(sq).or_else(sq), Ok(2));\nassert_eq!(Ok(2).or_else(err).or_else(sq), Ok(2));\nassert_eq!(Err(3).or_else(sq).or_else(err), Ok(9));\nassert_eq!(Err(3).or_else(err).or_else(err), Err(3));
\n
1.0.0 · source

pub fn unwrap_or(self, default: T) -> T

Returns the contained Ok value or a provided default.

\n

Arguments passed to unwrap_or are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use unwrap_or_else,\nwhich is lazily evaluated.

\n
§Examples
\n
let default = 2;\nlet x: Result<u32, &str> = Ok(9);\nassert_eq!(x.unwrap_or(default), 9);\n\nlet x: Result<u32, &str> = Err(\"error\");\nassert_eq!(x.unwrap_or(default), default);
\n
1.0.0 · source

pub fn unwrap_or_else<F>(self, op: F) -> T
where\n F: FnOnce(E) -> T,

Returns the contained Ok value or computes it from a closure.

\n
§Examples
\n
fn count(x: &str) -> usize { x.len() }\n\nassert_eq!(Ok(2).unwrap_or_else(count), 2);\nassert_eq!(Err(\"foo\").unwrap_or_else(count), 3);
\n
1.58.0 · source

pub unsafe fn unwrap_unchecked(self) -> T

Returns the contained Ok value, consuming the self value,\nwithout checking that the value is not an Err.

\n
§Safety
\n

Calling this method on an Err is undefined behavior.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(unsafe { x.unwrap_unchecked() }, 2);
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nunsafe { x.unwrap_unchecked(); } // Undefined behavior!
\n
1.58.0 · source

pub unsafe fn unwrap_err_unchecked(self) -> E

Returns the contained Err value, consuming the self value,\nwithout checking that the value is not an Ok.

\n
§Safety
\n

Calling this method on an Ok is undefined behavior.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nunsafe { x.unwrap_err_unchecked() }; // Undefined behavior!
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nassert_eq!(unsafe { x.unwrap_err_unchecked() }, \"emergency failure\");
\n
",0,"cbor_smol::error::Result"],["
source§

impl<T, E> Serialize for Result<T, E>
where\n T: Serialize,\n E: Serialize,

source§

fn serialize<S>(\n &self,\n serializer: S,\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where\n S: Serializer,

Serialize this value into the given Serde serializer. Read more
","Serialize","cbor_smol::error::Result"],["
1.16.0 · source§

impl<T, U, E> Sum<Result<U, E>> for Result<T, E>
where\n T: Sum<U>,

source§

fn sum<I>(iter: I) -> Result<T, E>
where\n I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err\noccur, the sum of all elements is returned.

\n
§Examples
\n

This sums up every integer in a vector, rejecting the sum if a negative\nelement is encountered:

\n\n
let f = |&x: &i32| if x < 0 { Err(\"Negative element found\") } else { Ok(x) };\nlet v = vec![1, 2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Ok(3));\nlet v = vec![1, -2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Err(\"Negative element found\"));
\n
","Sum>","cbor_smol::error::Result"],["
source§

impl<T, E> Try for Result<T, E>

§

type Output = T

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value produced by ? when not short-circuiting.
§

type Residual = Result<Infallible, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value passed to FromResidual::from_residual\nas part of ? when short-circuiting. Read more
source§

fn from_output(output: <Result<T, E> as Try>::Output) -> Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from its Output type. Read more
source§

fn branch(\n self,\n) -> ControlFlow<<Result<T, E> as Try>::Residual, <Result<T, E> as Try>::Output>

🔬This is a nightly-only experimental API. (try_trait_v2)
Used in ? to decide whether the operator should produce a value\n(because this returned ControlFlow::Continue)\nor propagate a value back to the caller\n(because this returned ControlFlow::Break). Read more
","Try","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> Copy for Result<T, E>
where\n T: Copy,\n E: Copy,

","Copy","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> Eq for Result<T, E>
where\n T: Eq,\n E: Eq,

","Eq","cbor_smol::error::Result"],["
1.0.0 · source§

impl<T, E> StructuralPartialEq for Result<T, E>

","StructuralPartialEq","cbor_smol::error::Result"]] };if (window.register_type_impls) {window.register_type_impls(type_impls);} else {window.pending_type_impls = type_impls;}})() \ No newline at end of file