[−][src]Trait serde_mappable_seq::Key
The key to a keyed resource.
Implement this on the type of the value of a map to extract the key from it.
Examples
If you have a User resource, then it'll have an ID of some sort. For example, return the integer ID of a User struct:
use serde_derive::{Deserialize, Serialize}; use serde_mappable_seq::Key; struct User { id: u64, email: String, name: String, } impl Key<'_, u64> for User { fn key(&self) -> u64 { self.id } }
Required methods
fn key(&self) -> T
The method to extract an owned key from the type.