File tree Expand file tree Collapse file tree 8 files changed +13
-11
lines changed
factor-key-value-azure/src
factor-key-value-redis/src
factor-outbound-redis/src Expand file tree Collapse file tree 8 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,15 @@ use spin_key_value_azure::{
55} ;
66
77/// A key-value store that uses Azure Cosmos as the backend.
8+ #[ derive( Default ) ]
89pub struct AzureKeyValueStore {
910 _priv : ( ) ,
1011}
1112
1213impl AzureKeyValueStore {
1314 /// Creates a new `AzureKeyValueStore`.
1415 pub fn new ( ) -> Self {
15- Self { _priv : ( ) }
16+ Self :: default ( )
1617 }
1718}
1819
Original file line number Diff line number Diff line change @@ -3,14 +3,15 @@ use spin_factor_key_value::runtime_config::spin::MakeKeyValueStore;
33use spin_key_value_redis:: KeyValueRedis ;
44
55/// A key-value store that uses Redis as the backend.
6+ #[ derive( Default ) ]
67pub struct RedisKeyValueStore {
78 _priv : ( ) ,
89}
910
1011impl RedisKeyValueStore {
1112 /// Creates a new `RedisKeyValueStore`.
1213 pub fn new ( ) -> Self {
13- Self { _priv : ( ) }
14+ Self :: default ( )
1415 }
1516}
1617
Original file line number Diff line number Diff line change @@ -8,13 +8,14 @@ use spin_factors::{
88} ;
99
1010/// The [`Factor`] for `fermyon:spin/outbound-redis`.
11+ #[ derive( Default ) ]
1112pub struct OutboundRedisFactor {
1213 _priv : ( ) ,
1314}
1415
1516impl OutboundRedisFactor {
1617 pub fn new ( ) -> Self {
17- Self { _priv : ( ) }
18+ Self :: default ( )
1819 }
1920}
2021
Original file line number Diff line number Diff line change @@ -44,9 +44,10 @@ impl InstanceState {
4444 fn get_connection (
4545 & self ,
4646 connection : Resource < v2:: Connection > ,
47- ) -> Result < & Box < dyn Connection > , v2:: Error > {
47+ ) -> Result < & dyn Connection , v2:: Error > {
4848 self . connections
4949 . get ( connection. rep ( ) )
50+ . map ( |conn| conn. as_ref ( ) )
5051 . ok_or ( v2:: Error :: InvalidConnection )
5152 }
5253}
Original file line number Diff line number Diff line change @@ -104,7 +104,8 @@ impl FactorRuntimeConfigSource<SqliteFactor> for TomlRuntimeSource<'_> {
104104
105105impl RuntimeConfigSourceFinalizer for TomlRuntimeSource < ' _ > {
106106 fn finalize ( & mut self ) -> anyhow:: Result < ( ) > {
107- Ok ( self . table . validate_all_keys_used ( ) . unwrap ( ) )
107+ self . table . validate_all_keys_used ( ) ?;
108+ Ok ( ( ) )
108109 }
109110}
110111
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ pub enum AzureKeyVaultAuthOptions {
9090 ///
9191 /// Common across each:
9292 /// - `AZURE_AUTHORITY_HOST`: (optional) the host for the identity provider. For example, for Azure public cloud the host defaults to "https://login.microsoftonline.com".
93+ ///
9394 /// See also: https://github.com/Azure/azure-sdk-for-rust/blob/main/sdk/identity/README.md
9495 Environmental ,
9596}
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ async fn static_provider_works() -> anyhow::Result<()> {
3131 } ) ) ?;
3232
3333 let mut state = env. build_instance_state ( ) . await ?;
34- let val = state. variables . get ( "baz" . try_into ( ) . unwrap ( ) ) . await ?;
34+ let val = state. variables . get ( "baz" . into ( ) ) . await ?;
3535 assert_eq ! ( val, "<bar>" ) ;
3636 Ok ( ( ) )
3737}
Original file line number Diff line number Diff line change @@ -187,11 +187,7 @@ impl FactorRuntimeConfigSource<OutboundMysqlFactor> for TomlRuntimeConfigSource<
187187
188188impl FactorRuntimeConfigSource < LlmFactor > for TomlRuntimeConfigSource < ' _ > {
189189 fn get_runtime_config ( & mut self ) -> anyhow:: Result < Option < spin_factor_llm:: RuntimeConfig > > {
190- Ok ( llm:: runtime_config_from_toml (
191- self . table . as_ref ( ) ,
192- self . state_dir . clone ( ) ,
193- self . use_gpu ,
194- ) ?)
190+ llm:: runtime_config_from_toml ( self . table . as_ref ( ) , self . state_dir . clone ( ) , self . use_gpu )
195191 }
196192}
197193
You can’t perform that action at this time.
0 commit comments