Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OrgId conversions #6

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[package]
name = "locator"
version = "2.0.0"
version = "2.0.1"
edition = "2021"


[dependencies]
alphanumeric-sort = "1.5.3"
getset = "0.1.2"
Expand Down
24 changes: 24 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,30 @@ pub enum Fetcher {
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct OrgId(usize);

impl From<OrgId> for u64 {
fn from(value: OrgId) -> Self {
value.0 as u64
}
}

impl From<OrgId> for usize {
fn from(value: OrgId) -> Self {
value.0
}
}

impl From<OrgId> for i64 {
fn from(value: OrgId) -> Self {
value.0 as i64
}
}

impl From<OrgId> for isize {
fn from(value: OrgId) -> Self {
value.0 as isize
}
}

impl TryFrom<&str> for OrgId {
type Error = <usize as FromStr>::Err;

Expand Down
Loading