pub struct ConnectionStorage {
pub connections: Vec<ConnectionConfig>,
pub version: String,
}Expand description
Container for all saved connections
Fields§
§connections: Vec<ConnectionConfig>§version: StringVersion for future migration compatibility
Implementations§
Source§impl ConnectionStorage
impl ConnectionStorage
Sourcepub async fn load() -> Result<Self>
pub async fn load() -> Result<Self>
Load connections from storage asynchronously (non-blocking)
Sourcepub async fn save(&self) -> Result<()>
pub async fn save(&self) -> Result<()>
Save connections to storage asynchronously (non-blocking)
Sourcepub async fn add_connection(
&mut self,
connection: ConnectionConfig,
) -> Result<()>
pub async fn add_connection( &mut self, connection: ConnectionConfig, ) -> Result<()>
Add a new connection asynchronously
Sourcepub async fn remove_connection(&mut self, id: &str) -> Result<()>
pub async fn remove_connection(&mut self, id: &str) -> Result<()>
Remove a connection by ID asynchronously
Sourcepub async fn update_connection(
&mut self,
connection: ConnectionConfig,
) -> Result<()>
pub async fn update_connection( &mut self, connection: ConnectionConfig, ) -> Result<()>
Update a connection asynchronously
Sourcepub fn get_connection(&self, id: &str) -> Option<&ConnectionConfig>
pub fn get_connection(&self, id: &str) -> Option<&ConnectionConfig>
Get connection by ID
Sourcepub fn get_connection_mut(&mut self, id: &str) -> Option<&mut ConnectionConfig>
pub fn get_connection_mut(&mut self, id: &str) -> Option<&mut ConnectionConfig>
Get mutable connection by ID
Trait Implementations§
Source§impl Clone for ConnectionStorage
impl Clone for ConnectionStorage
Source§impl Debug for ConnectionStorage
impl Debug for ConnectionStorage
Source§impl Default for ConnectionStorage
impl Default for ConnectionStorage
Source§impl<'de> Deserialize<'de> for ConnectionStorage
impl<'de> Deserialize<'de> for ConnectionStorage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ConnectionStorage
impl RefUnwindSafe for ConnectionStorage
impl Send for ConnectionStorage
impl Sync for ConnectionStorage
impl Unpin for ConnectionStorage
impl UnsafeUnpin for ConnectionStorage
impl UnwindSafe for ConnectionStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more