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.
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());
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for PropertyBag
impl Send for PropertyBag
impl Sync for PropertyBag
impl Unpin for PropertyBag
impl !UnwindSafe for PropertyBag
Blanket Implementations
Mutably borrows from an owned value. Read more
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