chore: Arc the uri internal to and rarely used by Storage so that cloning it is cheaper
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
use std::{fmt::Debug, str::FromStr};
|
||||
use std::{fmt::Debug, str::FromStr, sync::Arc};
|
||||
|
||||
use opendal::{IntoOperatorUri, Operator, OperatorUri};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Storage {
|
||||
uri: OperatorUri,
|
||||
uri: Arc<OperatorUri>,
|
||||
operator: Operator,
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ impl FromStr for Storage {
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let uri = s.into_operator_uri()?;
|
||||
let operator = Operator::from_uri(&uri)?;
|
||||
|
||||
let uri = uri.into();
|
||||
|
||||
Ok(Self { uri, operator })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user