Struct aws_smithy_http::property_bag::PropertyBag[][src]

pub struct PropertyBag { /* fields omitted */ }
Expand description

A type-map of configuration data.

PropertyBag can be used by Request and Response to store data used to configure the SDK request pipeline.

TODO: We should consider if we want to require members of the property to be “resettable” in some way to reset any state prior to a retry. I think this is worth delaying until we need it, but is worth keeping in mind.

Implementations

Create an empty PropertyBag.

Insert a type into this PropertyBag.

If a value of this type already existed, it will be returned.

Examples
let mut props = PropertyBag::new();

#[derive(Debug, Eq, PartialEq)]
struct Endpoint(&'static str);
assert!(props.insert(Endpoint("dynamo.amazon.com")).is_none());
assert_eq!(
    props.insert(Endpoint("kinesis.amazon.com")),
    Some(Endpoint("dynamo.amazon.com"))
);

Get a reference to a type previously inserted on this PropertyBag.

Examples
let mut props = PropertyBag::new();
assert!(props.get::<i32>().is_none());
props.insert(5i32);

assert_eq!(props.get::<i32>(), Some(&5i32));

Get a mutable reference to a type previously inserted on this PropertyBag.

Examples
let mut props = PropertyBag::new();
props.insert(String::from("Hello"));
props.get_mut::<String>().unwrap().push_str(" World");

assert_eq!(props.get::<String>().unwrap(), "Hello World");

Remove a type from this PropertyBag.

If a value of this type existed, it will be returned.

Examples
let mut props = PropertyBag::new();
props.insert(5i32);
assert_eq!(props.remove::<i32>(), Some(5i32));
assert!(props.get::<i32>().is_none());

Clear the PropertyBag of all inserted extensions.

Examples
let mut props = PropertyBag::new();
props.insert(5i32);
props.clear();

assert!(props.get::<i32>().is_none());

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more