Struct dittolive_ditto::prelude::TransportConfig
source · [−]pub struct TransportConfig {
pub peer_to_peer: PeerToPeer,
pub connect: Connect,
pub listen: Listen,
pub global: Global,
}
Expand description
A configuration object specifying which network transports Ditto should use to sync data.
A Ditto
object comes with a default transport configuration where all
available peer-to-peer transports are enabled. You can customize this by
initializing a TransportConfig
, adjusting its properties, and supplying it
to set_transport_config()
on Ditto
.
When you initialize a TransportConfig
yourself it starts with all
transports disabled. You must enable each one directly.
Peer-to-peer transports will automatically discover peers in the vicinity
and create connections without any configuration. These are configured
inside the peer_to_peer
property. To turn each one on, set its enabled
property to true
.
To connect to a peer at a known location, such as a Ditto Big Peer, add its
address inside the connect
configuration. These are either host:port
strings for raw TCP sync, or a wss://…
URL for websockets.
The listen
configurations are for specific less common data sync
scenarios. Please read the documentation on the Ditto website for examples.
Incorrect use of listen
can result in insecure configurations.
Fields
peer_to_peer: PeerToPeer
connect: Connect
listen: Listen
global: Global
Implementations
sourceimpl TransportConfig
impl TransportConfig
pub fn new() -> Self
pub fn enable_all_peer_to_peer(&mut self)
Trait Implementations
sourceimpl Clone for TransportConfig
impl Clone for TransportConfig
sourcefn clone(&self) -> TransportConfig
fn clone(&self) -> TransportConfig
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for TransportConfig
impl Debug for TransportConfig
sourceimpl Default for TransportConfig
impl Default for TransportConfig
sourcefn default() -> TransportConfig
fn default() -> TransportConfig
Returns the “default value” for a type. Read more
sourceimpl PartialEq<TransportConfig> for TransportConfig
impl PartialEq<TransportConfig> for TransportConfig
sourcefn eq(&self, other: &TransportConfig) -> bool
fn eq(&self, other: &TransportConfig) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &TransportConfig) -> bool
fn ne(&self, other: &TransportConfig) -> bool
This method tests for !=
.
impl Eq for TransportConfig
impl StructuralEq for TransportConfig
impl StructuralPartialEq for TransportConfig
Auto Trait Implementations
impl RefUnwindSafe for TransportConfig
impl Send for TransportConfig
impl Sync for TransportConfig
impl Unpin for TransportConfig
impl UnwindSafe for TransportConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ManuallyDropMut for T
impl<T> ManuallyDropMut for T
type Ret = ManuallyDrop<T>
pub fn manually_drop_mut(&'__ mut self) -> &'__ mut ManuallyDrop<T>
impl<T> To for T where
T: ?Sized,
impl<T> To for T where
T: ?Sized,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more