pub enum ReadPreference {
Primary,
PrimaryPreferred,
Secondary,
SecondaryPreferred,
Nearest,
Region(String),
TagSet(Vec<HashMap<String, String>>),
}Expand description
Read preference for query routing.
Variants§
Primary
Always read from primary.
PrimaryPreferred
Prefer primary, fallback to secondary.
Secondary
Always read from secondary.
SecondaryPreferred
Prefer secondary, fallback to primary.
Nearest
Read from nearest replica by latency.
Region(String)
Read from specific region.
TagSet(Vec<HashMap<String, String>>)
Custom tag set (MongoDB).
Implementations§
Source§impl ReadPreference
impl ReadPreference
Sourcepub fn to_mongodb(&self) -> &'static str
pub fn to_mongodb(&self) -> &'static str
Convert to MongoDB read preference string.
Sourcepub fn allows_primary(&self) -> bool
pub fn allows_primary(&self) -> bool
Check if this preference allows reading from primary.
Sourcepub fn allows_secondary(&self) -> bool
pub fn allows_secondary(&self) -> bool
Check if this preference allows reading from secondary.
Trait Implementations§
Source§impl Clone for ReadPreference
impl Clone for ReadPreference
Source§fn clone(&self) -> ReadPreference
fn clone(&self) -> ReadPreference
Returns a duplicate 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 ReadPreference
impl Debug for ReadPreference
Source§impl Default for ReadPreference
impl Default for ReadPreference
Source§impl<'de> Deserialize<'de> for ReadPreference
impl<'de> Deserialize<'de> for ReadPreference
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
Source§impl PartialEq for ReadPreference
impl PartialEq for ReadPreference
Source§impl Serialize for ReadPreference
impl Serialize for ReadPreference
impl Eq for ReadPreference
impl StructuralPartialEq for ReadPreference
Auto Trait Implementations§
impl Freeze for ReadPreference
impl RefUnwindSafe for ReadPreference
impl Send for ReadPreference
impl Sync for ReadPreference
impl Unpin for ReadPreference
impl UnwindSafe for ReadPreference
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