This commit is contained in:
JMARyA 2024-07-19 11:35:24 +02:00
parent 3f251a224f
commit b3004b0db3
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -9,7 +9,6 @@ You can derive the `Model` and `Referencable` traits for your struct. This will
```rust
use serde::{Deserialize, Serialize};
use mongod::Historic;
use mongod::Validate;
use mongod::Reference;
use mongod::derive::{Module, Referencable};
@ -22,8 +21,8 @@ struct MyStruct {
}
impl Validate for MyStruct {
async fn validate(&self) -> bool {
true
async fn validate(&self) -> Result<(), String> {
Ok(())
}
}
```
@ -86,12 +85,12 @@ struct YetAnotherStruct {
}
impl Validate for MyStruct {
async fn validate(&self) -> bool {
async fn validate(&self) -> Result<(), String> {
if let Some(other) = self.other {
assert_reference_of!(other, OtherStruct, YetAnotherStruct);
}
true
Ok(())
}
}
```