From 6bfa391104eea411631c40be3db123357b6a44a3 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 5 Nov 2020 21:13:37 +0100 Subject: [PATCH] Improve docs for lazy loading --- ruma-client-api/src/r0/filter.rs | 2 ++ ruma-client-api/src/r0/filter/lazy_load.rs | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ruma-client-api/src/r0/filter.rs b/ruma-client-api/src/r0/filter.rs index 6be07657..329d28fb 100644 --- a/ruma-client-api/src/r0/filter.rs +++ b/ruma-client-api/src/r0/filter.rs @@ -93,6 +93,8 @@ pub struct RoomEventFilter<'a> { pub url_filter: Option, /// Options to control lazy-loading of membership events. + /// + /// Defaults to `LazyLoadOptions::Disabled`. #[serde(flatten)] pub lazy_load_options: LazyLoadOptions, } diff --git a/ruma-client-api/src/r0/filter/lazy_load.rs b/ruma-client-api/src/r0/filter/lazy_load.rs index 37b35a6b..e5286ae8 100644 --- a/ruma-client-api/src/r0/filter/lazy_load.rs +++ b/ruma-client-api/src/r0/filter/lazy_load.rs @@ -29,6 +29,13 @@ impl LazyLoadOptions { } } +impl Default for LazyLoadOptions { + /// `LazyLoadOptions::Disabled` + fn default() -> Self { + Self::Disabled + } +} + impl Serialize for LazyLoadOptions { fn serialize(&self, serializer: S) -> Result where @@ -53,12 +60,6 @@ impl Serialize for LazyLoadOptions { } } -impl Default for LazyLoadOptions { - fn default() -> Self { - Self::Disabled - } -} - struct LazyLoadOptionsVisitor; impl<'de> Visitor<'de> for LazyLoadOptionsVisitor {