update
This commit is contained in:
parent
3f251a224f
commit
b3004b0db3
1 changed files with 4 additions and 5 deletions
|
@ -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(())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue