pub struct User {
pub id: UserId,
pub username: String,
pub display_name: Option<String>,
pub email: Option<String>,
pub bio: Option<String>,
pub location: Option<String>,
pub website: Option<String>,
pub avatar_url: Option<String>,
pub public_key: String,
pub email_public: bool,
pub created_at: u64,
pub updated_at: u64,
}Expand description
A user account in the system.
Fields§
§id: UserIdUnique user ID.
username: StringUnique username (lowercase, alphanumeric with hyphens).
display_name: Option<String>Display name (can contain any characters).
email: Option<String>Email address (optional).
bio: Option<String>Short biography.
location: Option<String>Location string.
website: Option<String>Personal website URL.
avatar_url: Option<String>Avatar URL.
public_key: StringEd25519 public key (hex-encoded identity).
email_public: boolWhether the user’s email is public.
created_at: u64Unix timestamp when created.
updated_at: u64Unix timestamp when last updated.
Implementations§
Source§impl User
impl User
Sourcepub fn validate_username(username: &str) -> Result<(), String>
pub fn validate_username(username: &str) -> Result<(), String>
Validate a username format.
Usernames must:
- Be 1-39 characters long
- Start with an alphanumeric character
- Contain only lowercase alphanumeric characters and hyphens
- Not contain consecutive hyphens
- Not end with a hyphen
Sourcepub fn to_profile(
&self,
public_repos: u64,
followers: u64,
following: u64,
) -> UserProfile
pub fn to_profile( &self, public_repos: u64, followers: u64, following: u64, ) -> UserProfile
Convert to a public profile (for API responses).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for User
impl<'de> Deserialize<'de> for User
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for User
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnsafeUnpin for User
impl UnwindSafe for User
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more