Download crates/forge_app/src/user.rs from SaylorTwift/forgecode: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/SaylorTwift/forgecode/resolve/main/crates/forge_app/src/user.rs
- Command line
-
hf download hf://SaylorTwift/forgecode/crates/forge_app/src/user.rs
-
curl -L -o user.rs https://huggingface.co/SaylorTwift/forgecode/resolve/main/crates/forge_app/src/user.rs
1.13 kB
| use serde::{Deserialize, Serialize}; | |
| pub struct AuthProviderId(String); | |
| impl AuthProviderId { | |
| pub fn new(id: impl ToString) -> Self { | |
| Self(id.to_string()) | |
| } | |
| pub fn into_string(self) -> String { | |
| self.0 | |
| } | |
| } | |
| pub struct User { | |
| pub auth_provider_id: AuthProviderId, | |
| } | |
| pub struct Plan { | |
| pub r#type: String, | |
| } | |
| impl Plan { | |
| pub fn is_upgradeable(&self) -> bool { | |
| matches!(self.r#type.to_lowercase().as_str(), "free" | "pro") | |
| } | |
| } | |
| pub struct UsageInfo { | |
| pub current: u32, | |
| pub limit: u32, | |
| pub remaining: u32, | |
| pub reset_in: Option<u64>, | |
| } | |
| pub struct UserUsage { | |
| pub plan: Plan, | |
| pub usage: UsageInfo, | |
| } | |