Struct jplaceholder::user::User [−][src]
pub struct User { pub id: i32, pub name: String, pub username: String, pub email: String, pub address: Address, pub phone: String, pub website: String, pub company: Company, }
Fields
id: i32
name: String
username: String
email: String
address: Address
phone: String
website: String
company: Company
Methods
impl User
[src]
impl User
pub fn posts(&self) -> Option<Vec<Post>>
[src]
pub fn posts(&self) -> Option<Vec<Post>>
Gets all the articles posted by this user
Example
use jplaceholder::Model; use jplaceholder::User; use jplaceholder::Post; let user = match User::find(1) { Some(u) => u, None => panic!("user not found") }; let posts: Vec<Post> = user.posts().expect("This user has posted no article"); println!("{} posted {} articles", user.name, posts.len());
Trait Implementations
impl Debug for User
[src]
impl Debug for User
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for User
[src]
impl PartialEq for User
fn eq(&self, other: &User) -> bool
[src]
fn eq(&self, other: &User) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]This method tests for !=
.
impl Model<User> for User
[src]
impl Model<User> for User