Improve docs for lazy loading

This commit is contained in:
Jonas Platte 2020-11-05 21:13:37 +01:00
parent d476046443
commit 6bfa391104
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
2 changed files with 9 additions and 6 deletions

View File

@ -93,6 +93,8 @@ pub struct RoomEventFilter<'a> {
pub url_filter: Option<UrlFilter>, pub url_filter: Option<UrlFilter>,
/// Options to control lazy-loading of membership events. /// Options to control lazy-loading of membership events.
///
/// Defaults to `LazyLoadOptions::Disabled`.
#[serde(flatten)] #[serde(flatten)]
pub lazy_load_options: LazyLoadOptions, pub lazy_load_options: LazyLoadOptions,
} }

View File

@ -29,6 +29,13 @@ impl LazyLoadOptions {
} }
} }
impl Default for LazyLoadOptions {
/// `LazyLoadOptions::Disabled`
fn default() -> Self {
Self::Disabled
}
}
impl Serialize for LazyLoadOptions { impl Serialize for LazyLoadOptions {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@ -53,12 +60,6 @@ impl Serialize for LazyLoadOptions {
} }
} }
impl Default for LazyLoadOptions {
fn default() -> Self {
Self::Disabled
}
}
struct LazyLoadOptionsVisitor; struct LazyLoadOptionsVisitor;
impl<'de> Visitor<'de> for LazyLoadOptionsVisitor { impl<'de> Visitor<'de> for LazyLoadOptionsVisitor {