id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:21
.push_shared_layer(layer_2.clone()); bag_2.push_shared_layer(layer_2).push_shared_layer(layer_1); // bags have same layers but in different orders assert_eq!(bag_1.load::<Foo>(), Some(&Foo(1))); assert_eq!(bag_2.load::<Foo>(), Some(&Foo(0))); bag_1.interceptor_state().store_put...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
eb5d5753cf1c50253e1e392e0010fad9319433eb
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/eb5d5753cf1c50253e1e392e0010fad9319433eb/sdk/aws-smithy-types/src/config_bag.rs
801
860
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:22
#[test] fn cloning_layers() { #[derive(Clone, Debug)] struct TestStr(String); impl Storable for TestStr { type Storer = StoreReplace<TestStr>; } let mut layer_1 = CloneableLayer::new("layer_1"); let expected_str = "I can be cloned"; layer_1.store_p...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
eb5d5753cf1c50253e1e392e0010fad9319433eb
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/eb5d5753cf1c50253e1e392e0010fad9319433eb/sdk/aws-smithy-types/src/config_bag.rs
841
878
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:3
/// ``` #[derive(Debug, Default)] pub struct CloneableLayer(Layer); impl Deref for CloneableLayer { type Target = Layer; fn deref(&self) -> &Self::Target { &self.0 } } impl Clone for CloneableLayer { fn clone(&self) -> Self { Self( self.try_clone() .expect(...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
d6094a52137879b5d330d3c187cee3f9cc4e0945
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/d6094a52137879b5d330d3c187cee3f9cc4e0945/sdk/aws-smithy-types/src/config_bag.rs
81
140
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:4
pub fn unset<T: Send + Sync + Clone + Debug + 'static>(&mut self) -> &mut Self { self.0.unset::<T>(); self } fn put_directly_cloneable<T: Store>(&mut self, value: T::StoredType) -> &mut Self where T::StoredType: Clone, { self.0 .props .insert(Type...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
d6094a52137879b5d330d3c187cee3f9cc4e0945
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/d6094a52137879b5d330d3c187cee3f9cc4e0945/sdk/aws-smithy-types/src/config_bag.rs
121
180
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:21
.push_shared_layer(layer_2.clone()); bag_2.push_shared_layer(layer_2).push_shared_layer(layer_1); // bags have same layers but in different orders assert_eq!(bag_1.load::<Foo>(), Some(&Foo(1))); assert_eq!(bag_2.load::<Foo>(), Some(&Foo(0))); bag_1.interceptor_state().store_put...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
d6094a52137879b5d330d3c187cee3f9cc4e0945
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/d6094a52137879b5d330d3c187cee3f9cc4e0945/sdk/aws-smithy-types/src/config_bag.rs
801
860
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:22
#[test] fn cloning_layers() { #[derive(Clone, Debug)] struct TestStr(String); impl Storable for TestStr { type Storer = StoreReplace<TestStr>; } let mut layer_1 = CloneableLayer::new("layer_1"); let expected_str = "I can be cloned"; layer_1.store_p...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
d6094a52137879b5d330d3c187cee3f9cc4e0945
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/d6094a52137879b5d330d3c187cee3f9cc4e0945/sdk/aws-smithy-types/src/config_bag.rs
841
874
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:1
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ //! Layered Configuration Bag Structure //! //! [`config_bag::ConfigBag`] represents the layered configuration structure //! with the following properties: //! 1. A new layer of configuration may be appl...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
1
60
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:2
} /// Private module to keep Value type while avoiding "private type in public latest" pub(crate) mod value { #[derive(Clone, Debug)] pub enum Value<T> { Set(T), ExplicitlyUnset(&'static str), } } use value::Value; impl<T: Default> Default for Value<T> { fn default() -> Self { ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
41
100
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:3
} } impl Clone for CloneableLayer { fn clone(&self) -> Self { Self( self.try_clone() .expect("only cloneable types can be inserted"), ) } } impl From<CloneableLayer> for Layer { fn from(cloneable_layer: CloneableLayer) -> Layer { cloneable_layer.0 } ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
81
140
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:4
self.props .insert(TypeId::of::<T>(), TypeErasedBox::new_with_clone(value)); self } /// Stores `item` of type `T` into the config bag, overriding a previous value of the same type pub fn store_put<T>(&mut self, item: T) -> &mut Self where T: Storable<Storer = StoreReplace<T>...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
121
180
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:5
/// Clears the value of type `T` from the config bag pub fn clear<T>(&mut self) where T: Storable<Storer = StoreAppend<T>> + Clone, { self.put_directly::<StoreAppend<T>>(Value::ExplicitlyUnset(type_name::<T>())); } fn get_mut_or_default<T: Send + Sync + Store + 'static>(&mut self) -...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
161
220
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:6
} } impl Layer { fn try_clone(&self) -> Option<Self> { let new_props = self .props .iter() .flat_map(|(tyid, erased)| erased.try_clone().map(|e| (*tyid, e))) .collect::<TypeIdMap<_>>(); if new_props.len() == self.props.len() { Some(Layer {...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
201
260
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:7
props: Default::default(), } } pub fn with_name(self, name: impl Into<Cow<'static, str>>) -> Self { Self { name: name.into(), props: self.props, } } /// Load a storable item from the bag pub fn load<T: Storable>(&self) -> <T::Storer as Store>::Return...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
241
300
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:8
where T: Storable<Storer = StoreReplace<T>>, { let item = match item { Some(item) => Value::Set(item), None => Value::ExplicitlyUnset(type_name::<T>()), }; self.put_directly::<StoreReplace<T>>(item); self } /// This can only be used for types ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
281
340
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:9
v @ Value::ExplicitlyUnset(_) => *v = Value::Set(vec![item]), } self } /// Clears the value of type `T` from the config bag /// /// This internally marks the item of type `T` as cleared as opposed to wiping it out from the /// config bag. pub fn clear<T>(&mut self) where ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
321
380
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:10
.expect("typechecked") } } impl FrozenLayer { /// Attempts to convert this bag directly into a [`ConfigBag`] if no other references exist /// /// This allows modifying the top layer of the bag. [`Self::add_layer`] may be /// used to add a new layer to the bag. pub fn try_modify(self) -> Option<...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
361
420
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:11
/// Configuration may then be "layered" onto the base by calling /// [`ConfigBag::store_put`], [`ConfigBag::store_or_unset`], [`ConfigBag::store_append`]. Layers /// of configuration may then be "frozen" (made immutable) by calling [`ConfigBag::freeze`]. pub fn base() -> Self { ConfigBag { ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
401
460
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:12
/// Return a mutable reference to `T` if it is stored in the top layer of the bag pub fn get_mut<T: Send + Sync + Debug + Clone + 'static>(&mut self) -> Option<&mut T> where T: Storable<Storer = StoreReplace<T>>, { // this code looks weird to satisfy the borrow checker—we can't keep the resu...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
441
500
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:13
/// Returns a mutable reference to `T` if it is stored in the top layer of the bag /// /// - If `T` is in a deeper layer of the bag, that value will be cloned and inserted into the top layer /// - If `T` is not present in the bag, `default` will be used to construct a new value pub fn get_mut_or_else<T:...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
481
540
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:14
/// */ /// ``` pub fn with_fn( self, name: impl Into<Cow<'static, str>>, next: impl Fn(&mut Layer), ) -> ConfigBag { let mut new_layer = Layer::new(name); next(&mut new_layer); let ConfigBag { interceptor_state: head, mut tail, ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
521
580
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:15
tail: self.tail.iter().rev(), } } } /// Iterator of items returned from config_bag pub struct ItemIter<'a, T> { inner: BagIter<'a>, t: PhantomData<T>, } impl<'a, T> Debug for ItemIter<'a, T> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!(f, "ItemIter") } } imp...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
561
620
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:16
fn next(&mut self) -> Option<Self::Item> { if let Some(head) = self.head.take() { Some(head) } else { self.tail.next().map(|t| t.deref()) } } } impl From<Layer> for FrozenLayer { fn from(layer: Layer) -> Self { FrozenLayer(Arc::new(layer)) } } #[cfg(...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
601
660
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:17
#[derive(Debug)] struct Prop3; impl Storable for Prop3 { type Storer = StoreReplace<Self>; } let mut base_bag = ConfigBag::base() .with_fn("a", layer_a) .with_fn("b", layer_b); base_bag.interceptor_state().store_put(Prop3); assert!(bas...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
641
700
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:18
} let bag = bag.with_fn("service config", |layer: &mut Layer| { layer.store_put(Region("asdf")); }); assert_eq!(bag.load::<Region>().unwrap().0, "asdf"); #[derive(Debug)] struct SigningName(&'static str); impl Storable for SigningName { type Stor...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
681
740
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:19
layer.store_append(Interceptor("123")); layer.store_append(Interceptor("456")); let mut second_layer = Layer::new("next"); second_layer.store_append(Interceptor("789")); let mut bag = ConfigBag::of_layers(vec![layer, second_layer]); assert_eq!( bag.load::<Intercept...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
721
780
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:20
expected.reverse(); assert_eq!( bag.load::<TestItem>().cloned().collect::<Vec<_>>(), expected ); } #[test] fn adding_layers() { let mut layer_1 = Layer::new("layer1"); let mut layer_2 = Layer::new("layer2"); #[derive(Clone, Debug, PartialEq,...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
761
820
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:21
#[test] fn get_mut_or_else() { #[derive(Clone, Debug, PartialEq, Eq, Default)] struct Foo(usize); impl Storable for Foo { type Storer = StoreReplace<Foo>; } let mut bag = ConfigBag::base(); assert_eq!(bag.get_mut::<Foo>(), None); assert_eq!(bag.ge...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
801
860
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:22
assert_eq!(expected_str, &layer_1_cloned.load::<TestStr>().unwrap().0); #[derive(Clone, Debug)] struct Rope(String); impl Storable for Rope { type Storer = StoreAppend<Rope>; } let mut layer_2 = CloneableLayer::new("layer_2"); layer_2.store_append(Rope("A".to...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9cdded794aa443896c1c957b0798f534aa42d298
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9cdded794aa443896c1c957b0798f534aa42d298/sdk/aws-smithy-types/src/config_bag.rs
841
863
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:6
} } impl Layer { fn try_clone(&self) -> Option<Self> { let new_props = self .props .iter() .flat_map(|(tyid, erased)| erased.try_clone().map(|e| (*tyid, e))) .collect::<TypeIdMap<_>>(); if new_props.len() == self.props.len() { Some(Layer {...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
201
260
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:7
props: Default::default(), } } /// Load a storable item from the bag pub fn load<T: Storable>(&self) -> <T::Storer as Store>::ReturnedType<'_> { T::Storer::merge_iter(ItemIter { inner: BagIter { head: Some(self), tail: [].iter().rev(), ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
241
300
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:9
/// This internally marks the item of type `T` as cleared as opposed to wiping it out from the /// config bag. pub fn clear<T>(&mut self) where T: Storable<Storer = StoreAppend<T>>, { self.put_directly::<StoreAppend<T>>(Value::ExplicitlyUnset(type_name::<T>())); } /// Retrieves ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
321
380
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:10
/// This allows modifying the top layer of the bag. [`Self::add_layer`] may be /// used to add a new layer to the bag. pub fn try_modify(self) -> Option<Layer> { Arc::try_unwrap(self.0).ok() } } /// Layered Configuration Structure /// /// [`ConfigBag`] is the "unlocked" form of the bag. Only the to...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
361
420
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:11
props: Default::default(), }, tail: vec![], } } pub fn of_layers(layers: Vec<Layer>) -> Self { let mut bag = ConfigBag::base(); for layer in layers { bag.push_layer(layer); } bag } pub fn push_layer(&mut self, layer: Layer) ->...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
401
460
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:12
// store, the value, then pull it right back if matches!(self.interceptor_state.get_mut::<StoreReplace<T>>(), None) { let new_item = match self.tail.iter().find_map(|b| b.load::<T>()) { Some(item) => item.clone(), None => return None, }; self.i...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
441
500
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:13
) -> &mut T where T: Storable<Storer = StoreReplace<T>>, { // this code looks weird to satisfy the borrow checker—we can't keep the result of `get_mut` // alive (even in a returned branch) and then call `store_put`. So: drop the borrow immediately // store, the value, then pull i...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
481
540
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:14
let mut new_layer = Layer::new(name); next(&mut new_layer); let ConfigBag { interceptor_state: head, mut tail, } = self; tail.push(head.freeze()); ConfigBag { interceptor_state: new_layer, tail, } } /// Add a new la...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
521
580
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:15
inner: BagIter<'a>, t: PhantomData<T>, } impl<'a, T> Debug for ItemIter<'a, T> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!(f, "ItemIter") } } impl<'a, T: 'a> Iterator for ItemIter<'a, T> where T: Store, { type Item = &'a T::StoredType; fn next(&mut self) -> Opt...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
561
620
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:16
} impl From<Layer> for FrozenLayer { fn from(layer: Layer) -> Self { FrozenLayer(Arc::new(layer)) } } #[cfg(test)] mod test { use super::ConfigBag; use crate::config_bag::{CloneableLayer, Layer, Storable, StoreAppend, StoreReplace}; #[test] fn layered_property_bag() { #[derive...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
601
660
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:17
.with_fn("a", layer_a) .with_fn("b", layer_b); base_bag.interceptor_state().store_put(Prop3); assert!(base_bag.load::<Prop1>().is_some()); #[derive(Debug)] struct Prop4; impl Storable for Prop4 { type Storer = StoreReplace<Self>; } let la...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
641
700
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:18
#[derive(Debug)] struct SigningName(&'static str); impl Storable for SigningName { type Storer = StoreReplace<Self>; } let operation_config = bag.with_fn("operation", |layer: &mut Layer| { layer.store_put(SigningName("s3")); }); assert_eq!(operati...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
681
740
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:19
assert_eq!( bag.load::<Interceptor>().collect::<Vec<_>>(), vec![ &Interceptor("789"), &Interceptor("456"), &Interceptor("123") ] ); let mut final_layer = Layer::new("final"); final_layer.clear::<Interceptor>(); ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
721
780
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:20
#[test] fn adding_layers() { let mut layer_1 = Layer::new("layer1"); let mut layer_2 = Layer::new("layer2"); #[derive(Clone, Debug, PartialEq, Eq, Default)] struct Foo(usize); impl Storable for Foo { type Storer = StoreReplace<Foo>; } layer_1.st...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
761
820
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:21
let mut bag = ConfigBag::base(); assert_eq!(bag.get_mut::<Foo>(), None); assert_eq!(bag.get_mut_or_default::<Foo>(), &Foo(0)); bag.get_mut_or_default::<Foo>().0 += 1; assert_eq!(bag.load::<Foo>(), Some(&Foo(1))); let old_ref = bag.load::<Foo>().unwrap(); assert_eq!(old_r...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
801
856
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:22
let mut layer_2 = CloneableLayer::new("layer_2"); layer_2.store_append(Rope("A".to_owned())); layer_2.store_append(Rope("big".to_owned())); layer_2.store_append(Rope("rope".to_owned())); let layer_2_cloned = layer_2.clone(); let rope = layer_2_cloned.load::<Rope>().cloned().colle...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
253a15511a6a5f2940e1c914cc11de3a55235259
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/253a15511a6a5f2940e1c914cc11de3a55235259/sdk/aws-smithy-types/src/config_bag.rs
841
856
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:1
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ //! Layered Configuration Bag Structure //! //! [`config_bag::ConfigBag`] represents the layered configuration structure //! with the following properties: //! 1. A new layer of configuration may be appl...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
1
60
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:2
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_list().entries(self.0.layers()).finish() } } f.debug_struct("ConfigBag") .field("layers", &Layers(self)) .finish() } } /// [`FrozenLayer`] is the "locked" form of [`Layer`]. /// //...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
41
100
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:3
/// [`CloneableLayer`] allows itself to be cloned. This is useful when a type that implements /// `Clone` wishes to store a config layer. /// /// It ensures that all the items in `CloneableLayer` are `Clone` upon entry, e.g. when they are /// first stored, the mutable methods require that they have a `Clone` bound on t...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
81
140
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:4
// We need to "override" the mutable methods to encode the information that an item being stored // implements `Clone`. For the immutable methods, they can just be delegated via the `Deref` trait. impl CloneableLayer { /// Creates a new `CloneableLayer` with a given name pub fn new(name: impl Into<Cow<'static, ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
121
180
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:5
where T: Storable<Storer = StoreReplace<T>> + Clone, { let item = match item { Some(item) => Value::Set(item), None => Value::ExplicitlyUnset(type_name::<T>()), }; self.put_directly::<StoreReplace<T>>(item); self } /// Stores `item` of type `T...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
161
220
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:6
.expect("typechecked") } } /// A named layer comprising a config bag #[derive(Default)] pub struct Layer { name: Cow<'static, str>, props: TypeIdMap<TypeErasedBox>, } impl Debug for Layer { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { struct Items<'a>(&'a Layer); impl Deb...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
201
260
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:7
} } /// Inserts `value` into the layer directly fn put_directly<T: Store>(&mut self, value: T::StoredType) -> &mut Self { self.props .insert(TypeId::of::<T>(), TypeErasedBox::new(value)); self } pub fn empty(&self) -> bool { self.props.is_empty() } pub ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
241
300
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:8
self.put_directly::<StoreReplace<T>>(Value::ExplicitlyUnset(type_name::<T>())); self } /// Insert `value` into the bag /// /// NOTE: This method exists for legacy reasons to allow storing values that are not `Storeable` /// /// The implementation assumes that the type is [`StoreReplace`...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
281
340
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:9
/// let mut layer_1 = Layer::new("example"); /// #[derive(Debug, PartialEq, Eq)] /// struct Interceptor(&'static str); /// impl Storable for Interceptor { /// type Storer = StoreAppend<Interceptor>; /// } /// /// layer_1.store_append(Interceptor("321")); /// layer_1.store_append(Inte...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
321
380
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:10
} /// Retrieves the value of type `T` from this layer if exists fn get<T: Send + Sync + Store + 'static>(&self) -> Option<&T::StoredType> { self.props .get(&TypeId::of::<T>()) .map(|t| t.downcast_ref().expect("typechecked")) } /// Returns a mutable reference to `T` if i...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
361
420
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:11
impl ConfigBag { /// Create a new config bag "base". /// /// Configuration may then be "layered" onto the base by calling /// [`ConfigBag::store_put`], [`ConfigBag::store_or_unset`], [`ConfigBag::store_append`]. Layers /// of configuration may then be "frozen" (made immutable) by calling [`ConfigBag...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
401
460
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:12
self.sourced_get::<T::Storer>() } /// Retrieve the value of type `T` from the bag if exists pub fn get<T: Send + Sync + Debug + 'static>(&self) -> Option<&T> { let out = self.sourced_get::<StoreReplace<T>>(); out } /// Return a mutable reference to `T` if it is stored in the top la...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
441
500
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:13
pub fn get_mut_or_default<T: Send + Sync + Debug + Clone + Default + 'static>( &mut self, ) -> &mut T where T: Storable<Storer = StoreReplace<T>>, { self.get_mut_or_else(|| T::default()) } /// Returns a mutable reference to `T` if it is stored in the top layer of the bag ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
481
540
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:14
/// let first_layer = bag.with_fn("a", |b: &mut Layer| { b.put("a"); }); /// let second_layer = first_layer.with_fn("other", |b: &mut Layer| { b.put(1i32); }); /// // The number is only in the second layer /// assert_eq!(first_layer.get::<i32>(), None); /// assert_eq!(second_layer.get::<i32>(), Some(&1)...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
521
580
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:15
inner: self.layers(), t: PhantomData::default(), }; T::merge_iter(stored_type_iter) } fn layers(&self) -> BagIter<'_> { BagIter { head: Some(&self.interceptor_state), tail: self.tail.iter().rev(), } } } /// Iterator of items returned from...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
561
620
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:16
/// Iterator over the layers of a config bag struct BagIter<'a> { head: Option<&'a Layer>, tail: Rev<Iter<'a, FrozenLayer>>, } impl<'a> Iterator for BagIter<'a> { type Item = &'a Layer; fn next(&mut self) -> Option<Self::Item> { if let Some(head) = self.head.take() { Some(head) ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
601
660
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:17
bag.put(Prop2); }; #[derive(Debug)] struct Prop3; let mut base_bag = ConfigBag::base() .with_fn("a", layer_a) .with_fn("b", layer_b); base_bag.interceptor_state().put(Prop3); assert!(base_bag.get::<Prop1>().is_some()); #[derive(Debug)] ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
641
700
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:18
#[derive(Debug)] struct SigningName(&'static str); let operation_config = bag.with_fn("operation", |layer: &mut Layer| { layer.put(SigningName("s3")); }); assert_eq!(operation_config.get::<SigningName>().unwrap().0, "s3"); let mut open_bag = operation_config.with_fn...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
681
740
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:19
] ); let mut final_layer = Layer::new("final"); final_layer.clear::<Interceptor>(); bag.push_layer(final_layer); assert_eq!(bag.load::<Interceptor>().count(), 0); } #[test] fn store_append_many_layers() { #[derive(Debug, PartialEq, Eq, Clone)] struct...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
721
780
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:20
struct Foo(usize); impl Storable for Foo { type Storer = StoreReplace<Foo>; } layer_1.store_put(Foo(0)); layer_2.store_put(Foo(1)); let layer_1 = layer_1.freeze(); let layer_2 = layer_2.freeze(); let mut bag_1 = ConfigBag::base(); let mut ba...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
761
820
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:21
let old_ref = bag.load::<Foo>().unwrap(); assert_eq!(old_ref, &Foo(1)); // there is one in the bag, so it can be returned //let mut next = bag.add_layer("next"); bag.get_mut::<Foo>().unwrap().0 += 1; let new_ref = bag.load::<Foo>().unwrap(); assert_eq!(new_ref, &Foo(2));...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
7150a0800de9b7529f79521b351b8d7ea31fbfd0
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/7150a0800de9b7529f79521b351b8d7ea31fbfd0/sdk/aws-smithy-types/src/config_bag.rs
801
849
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:3
/// [`CloneableLayer`] allows itself to be cloned. This is useful when a type that implements /// `Clone` wishes to store a config layer. /// /// It ensures that all the items in `CloneableLayer` are `Clone` upon entry, e.g. when they are /// first stored, the mutable methods require that they have a `Clone` bound on t...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
81
140
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:4
Self(Layer::new(name)) } pub fn freeze(self) -> FrozenLayer { self.0.into() } /// Removes `T` from this bag pub fn unset<T: Send + Sync + Clone + Debug + 'static>(&mut self) -> &mut Self { self.put_directly::<StoreReplace<T>>(Value::ExplicitlyUnset(type_name::<T>())); self ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
121
180
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:5
}; self.put_directly::<StoreReplace<T>>(item); self } /// Stores `item` of type `T` into the config bag, appending it to the existing list of the same /// type pub fn store_append<T>(&mut self, item: T) -> &mut Self where T: Storable<Storer = StoreAppend<T>> + Clone, { ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
161
220
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:6
pub struct Layer { name: Cow<'static, str>, props: TypeIdMap<TypeErasedBox>, } impl Debug for Layer { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { struct Items<'a>(&'a Layer); impl Debug for Items<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
201
260
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:7
.insert(TypeId::of::<T>(), TypeErasedBox::new(value)); self } pub fn empty(&self) -> bool { self.props.is_empty() } pub fn freeze(self) -> FrozenLayer { self.into() } /// Create a new Layer with a given name pub fn new(name: impl Into<Cow<'static, str>>) -> Self { ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
241
300
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:8
/// NOTE: This method exists for legacy reasons to allow storing values that are not `Storeable` /// /// The implementation assumes that the type is [`StoreReplace`]. pub fn put<T: Send + Sync + Debug + 'static>(&mut self, value: T) -> &mut Self { self.put_directly::<StoreReplace<T>>(Value::Set(valu...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
281
340
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:9
/// /// layer_1.store_append(Interceptor("321")); /// layer_1.store_append(Interceptor("654")); /// /// let mut layer_2 = Layer::new("second layer"); /// layer_2.store_append(Interceptor("987")); /// /// let bag = ConfigBag::of_layers(vec![layer_1, layer_2]); /// /// assert_eq!( ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
321
380
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:10
.map(|t| t.downcast_ref().expect("typechecked")) } /// Returns a mutable reference to `T` if it is stored in this layer fn get_mut<T: Send + Sync + Store + 'static>(&mut self) -> Option<&mut T::StoredType> { self.props .get_mut(&TypeId::of::<T>()) .map(|t| t.downcast_mut().e...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
361
420
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:11
pub fn base() -> Self { ConfigBag { interceptor_state: Layer { name: Cow::Borrowed("interceptor_state"), props: Default::default(), }, tail: vec![], } } pub fn of_layers(layers: Vec<Layer>) -> Self { let mut bag = Confi...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
401
460
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:12
out } /// Return a mutable reference to `T` if it is stored in the top layer of the bag pub fn get_mut<T: Send + Sync + Debug + Clone + 'static>(&mut self) -> Option<&mut T> where T: Storable<Storer = StoreReplace<T>>, { // this code looks weird to satisfy the borrow checker—we can'...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
441
500
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:13
self.get_mut_or_else(|| T::default()) } /// Returns a mutable reference to `T` if it is stored in the top layer of the bag /// /// - If `T` is in a deeper layer of the bag, that value will be cloned and inserted into the top layer /// - If `T` is not present in the bag, `default` will be used to co...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
481
540
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:14
/// // The string is in both layers /// assert_eq!(first_layer.get::<&'static str>(), Some(&"a")); /// assert_eq!(second_layer.get::<&'static str>(), Some(&"a")); /// */ /// ``` pub fn with_fn( self, name: impl Into<Cow<'static, str>>, next: impl Fn(&mut Layer), ) -> Conf...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
521
580
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:15
fn layers(&self) -> BagIter<'_> { BagIter { head: Some(&self.interceptor_state), tail: self.tail.iter().rev(), } } } /// Iterator of items returned from config_bag pub struct ItemIter<'a, T> { inner: BagIter<'a>, t: PhantomData<T>, } impl<'a, T> Debug for ItemIter<'...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
561
620
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:16
impl<'a> Iterator for BagIter<'a> { type Item = &'a Layer; fn next(&mut self) -> Option<Self::Item> { if let Some(head) = self.head.take() { Some(head) } else { self.tail.next().map(|t| t.deref()) } } } impl From<Layer> for FrozenLayer { fn from(layer: L...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
601
660
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:17
let mut base_bag = ConfigBag::base() .with_fn("a", layer_a) .with_fn("b", layer_b); base_bag.interceptor_state().put(Prop3); assert!(base_bag.get::<Prop1>().is_some()); #[derive(Debug)] struct Prop4; let layer_c = |bag: &mut Layer| { bag.put(...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
641
700
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:18
assert_eq!(operation_config.get::<SigningName>().unwrap().0, "s3"); let mut open_bag = operation_config.with_fn("my_custom_info", |_bag: &mut Layer| {}); open_bag.interceptor_state().put("foo"); assert_eq!(open_bag.layers().count(), 4); } #[test] fn store_append() { let mu...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
681
740
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:19
assert_eq!(bag.load::<Interceptor>().count(), 0); } #[test] fn store_append_many_layers() { #[derive(Debug, PartialEq, Eq, Clone)] struct TestItem(i32, i32); impl Storable for TestItem { type Storer = StoreAppend<TestItem>; } let mut expected = vec![]; ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
721
780
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:20
layer_2.store_put(Foo(1)); let layer_1 = layer_1.freeze(); let layer_2 = layer_2.freeze(); let mut bag_1 = ConfigBag::base(); let mut bag_2 = ConfigBag::base(); bag_1 .push_shared_layer(layer_1.clone()) .push_shared_layer(layer_2.clone()); bag_2....
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
761
820
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:21
let new_ref = bag.load::<Foo>().unwrap(); assert_eq!(new_ref, &Foo(2)); bag.interceptor_state().unset::<Foo>(); // if it was unset, we can't clone the current one, that would be wrong assert_eq!(bag.get_mut::<Foo>(), None); assert_eq!(bag.get_mut_or_default::<Foo>(), &Foo(0)); ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
b2321536670d876a056265237ef7e2b8e6d29a95
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/b2321536670d876a056265237ef7e2b8e6d29a95/sdk/aws-smithy-types/src/config_bag.rs
801
843
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:2
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_list().entries(self.0.layers()).finish() } } f.debug_struct("ConfigBag") .field("layers", &Layers(self)) .finish() } } /// [`FrozenLayer`] is the "locked" form of [`Layer`]. /// //...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
41
100
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:3
/// [`CloneableLayer`] allows itself to be cloned. This is useful when a type that implements /// `Clone` wishes to store a config layer. /// /// It ensures that all the items in `CloneableLayer` are `Clone` upon entry, e.g. when they are /// first stored, the mutable methods require that they have a `Clone` bound on t...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
81
140
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:5
}; self.put_directly::<StoreReplace<T>>(item); self } /// Stores `item` of type `T` into the config bag, appending it to the existing list of the same /// type pub fn store_append<T>(&mut self, item: T) -> &mut Self where T: Storable<Storer = StoreAppend<T>> + Clone, { ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
161
220
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:6
name: Cow<'static, str>, props: TypeIdMap<TypeErasedBox>, } impl Debug for Layer { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { struct Items<'a>(&'a Layer); impl Debug for Items<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_li...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
201
260
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:7
self } pub fn empty(&self) -> bool { self.props.is_empty() } pub fn freeze(self) -> FrozenLayer { self.into() } /// Create a new Layer with a given name pub fn new(name: impl Into<Cow<'static, str>>) -> Self { let name = name.into(); Self { name...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
241
300
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:8
/// /// The implementation assumes that the type is [`StoreReplace`]. pub fn put<T: Send + Sync + Debug + 'static>(&mut self, value: T) -> &mut Self { self.put_directly::<StoreReplace<T>>(Value::Set(value)); self } /// Stores `item` of type `T` into the config bag, overriding a previous...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
281
340
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:9
/// layer_1.store_append(Interceptor("321")); /// layer_1.store_append(Interceptor("654")); /// /// let mut layer_2 = Layer::new("second layer"); /// layer_2.store_append(Interceptor("987")); /// /// let bag = ConfigBag::of_layers(vec![layer_1, layer_2]); /// /// assert_eq!( /// ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
321
380
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:10
} /// Returns a mutable reference to `T` if it is stored in this layer fn get_mut<T: Send + Sync + Store + 'static>(&mut self) -> Option<&mut T::StoredType> { self.props .get_mut(&TypeId::of::<T>()) .map(|t| t.downcast_mut().expect("typechecked")) } /// Returns a mutabl...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
361
420
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:11
ConfigBag { interceptor_state: Layer { name: Cow::Borrowed("interceptor_state"), props: Default::default(), }, tail: vec![], } } pub fn of_layers(layers: Vec<Layer>) -> Self { let mut bag = ConfigBag::base(); for layer ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
401
460
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:12
} /// Return a mutable reference to `T` if it is stored in the top layer of the bag pub fn get_mut<T: Send + Sync + Debug + Clone + 'static>(&mut self) -> Option<&mut T> where T: Storable<Storer = StoreReplace<T>>, { // this code looks weird to satisfy the borrow checker—we can't keep t...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
441
500
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:13
} /// Returns a mutable reference to `T` if it is stored in the top layer of the bag /// /// - If `T` is in a deeper layer of the bag, that value will be cloned and inserted into the top layer /// - If `T` is not present in the bag, `default` will be used to construct a new value pub fn get_mut_or_...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
481
540
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:14
/// assert_eq!(first_layer.get::<&'static str>(), Some(&"a")); /// assert_eq!(second_layer.get::<&'static str>(), Some(&"a")); /// */ /// ``` pub fn with_fn( self, name: impl Into<Cow<'static, str>>, next: impl Fn(&mut Layer), ) -> ConfigBag { let mut new_layer = Laye...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
521
580
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:15
BagIter { head: Some(&self.interceptor_state), tail: self.tail.iter().rev(), } } } /// Iterator of items returned from config_bag pub struct ItemIter<'a, T> { inner: BagIter<'a>, t: PhantomData<T>, } impl<'a, T> Debug for ItemIter<'a, T> { fn fmt(&self, f: &mut Formatte...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
561
620
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:16
type Item = &'a Layer; fn next(&mut self) -> Option<Self::Item> { if let Some(head) = self.head.take() { Some(head) } else { self.tail.next().map(|t| t.deref()) } } } impl From<Layer> for FrozenLayer { fn from(layer: Layer) -> Self { FrozenLayer(Arc:...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
601
660
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:17
.with_fn("a", layer_a) .with_fn("b", layer_b); base_bag.interceptor_state().put(Prop3); assert!(base_bag.get::<Prop1>().is_some()); #[derive(Debug)] struct Prop4; let layer_c = |bag: &mut Layer| { bag.put(Prop4); bag.unset::<Prop3>(); ...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
641
700
awslabs/aws-sdk-rust:sdk/aws-smithy-types/src/config_bag.rs:18
assert_eq!(operation_config.get::<SigningName>().unwrap().0, "s3"); let mut open_bag = operation_config.with_fn("my_custom_info", |_bag: &mut Layer| {}); open_bag.interceptor_state().put("foo"); assert_eq!(open_bag.layers().count(), 4); } #[test] fn store_append() { let mu...
rust
rust
rust-source
awslabs/aws-sdk-rust
sdk/aws-smithy-types/src/config_bag.rs
Apache-2.0
9871230608154839a6cc0337ce06d00013ffb706
github
sdk
https://github.com/awslabs/aws-sdk-rust/blob/9871230608154839a6cc0337ce06d00013ffb706/sdk/aws-smithy-types/src/config_bag.rs
681
740