Write documentation for observe

This commit is contained in:
bitfl0wer 2024-01-21 20:13:00 +01:00
parent 57214fd2fe
commit a571a9e137
No known key found for this signature in database
GPG Key ID: 0ACD574FCF5226CF
1 changed files with 9 additions and 0 deletions

View File

@ -40,6 +40,15 @@ impl GatewayHandle {
.unwrap();
}
/// Recursively observes a [`Shared`] object, by making sure all [`Composite `] fields within
/// that object and its children are being watched.
///
/// Observing means, that if new information arrives about the observed object or its children,
/// the object automatically gets updated, without you needing to request new information about
/// the object in question from the API, which is expensive and can lead to rate limiting.
///
/// The [`Shared`] object returned by this method points to a different object than the one
/// being supplied as a &self function argument.
pub async fn observe<T: Updateable + Clone + Debug + Composite<T>>(
&self,
object: Shared<T>,