1#![cfg_attr(not(feature = "std"), no_std)]
2
3#[cfg(not(feature = "std"))]
4extern crate alloc;
5
6#[cfg(feature = "jkcenum_derive")]
7#[allow(unused_imports)]
8#[macro_use]
9extern crate jkcenum_derive;
10
11#[cfg(feature = "jkcenum_derive")]
12pub use jkcenum_derive::JkcEnum;
13
14#[cfg(not(feature = "std"))]
15use core::{
16 marker::Sized,
17 option::Option,
18 option::Option::{Some, None},
19 result::Result,
20 result::Result::Ok,
21};
22#[cfg(not(feature = "std"))]
23use alloc::string::{String, ToString};
24
25
26pub mod errors;
27
28
29pub trait FromInt {
30 type Err;
31
32 fn from_int(v: isize) -> Result<Self, Self::Err>
33 where
34 Self: Sized,
35 ;
36
37 #[inline]
38 fn from_int_to_string(v: isize) -> Option<String>
39 where
40 Self: Sized + ToString,
41 {
42 if let Ok(value) = Self::from_int(v) {
43 return Some(value.to_string())
44 }
45
46 None
47 }
48}