Skip to content

Commit

Permalink
Add OrgId conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
jssblck committed Jun 15, 2024
1 parent f0d2a57 commit 38a6bf4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
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

0 comments on commit 38a6bf4

Please sign in to comment.