#[non_exhaustive]pub struct DittoConfig {
pub database_id: String,
pub connect: DittoConfigConnect,
pub persistence_directory: Option<PathBuf>,
/* private fields */
}Expand description
Configuration options required to initialize a Ditto instance.
§Example
let connect = DittoConfigConnect::Server {
url: "REPLACE_ME_WITH_YOUR_SERVER_URL".parse().unwrap(),
};
let connect = DittoConfigConnect::SmallPeersOnly {
private_key: Some("REPLACE_ME_WITH_YOUR_PRIVATE_KEY".as_bytes().to_vec()),
};
let connect = DittoConfigConnect::SmallPeersOnly { private_key: None };
let config = DittoConfig::new(database_id, connect);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.database_id: StringAn ID used to distinguish between Ditto database instantations.
Note: This was formerly known as appId.
connect: DittoConfigConnectThe connection configuration this device uses to connect to a Ditto mesh.
persistence_directory: Option<PathBuf>The directory where Ditto will store its data.
Implementations§
Source§impl DittoConfig
impl DittoConfig
Sourcepub fn new<S: Into<String>>(database_id: S, connect: DittoConfigConnect) -> Self
pub fn new<S: Into<String>>(database_id: S, connect: DittoConfigConnect) -> Self
Create a new DittoConfig instance from a database ID and connection configuration.
Sourcepub fn with_persistence_directory<P: Into<PathBuf>>(self, path: P) -> Self
pub fn with_persistence_directory<P: Into<PathBuf>>(self, path: P) -> Self
Optionally specify a custom persistence directory.
Trait Implementations§
Source§impl Clone for DittoConfig
impl Clone for DittoConfig
Source§fn clone(&self) -> DittoConfig
fn clone(&self) -> DittoConfig
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DittoConfig
impl Debug for DittoConfig
Source§impl<'de> Deserialize<'de> for DittoConfig
impl<'de> Deserialize<'de> for DittoConfig
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 DittoConfig
impl RefUnwindSafe for DittoConfig
impl Send for DittoConfig
impl Sync for DittoConfig
impl Unpin for DittoConfig
impl UnwindSafe for DittoConfig
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