Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2572051
helpers.rs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
571 B
Referenced Files
None
Subscribers
None
helpers.rs
View Options
use
anyhow
::
Error
;
use
macros_rs
::
str
;
use
std
::
path
::
Path
;
use
std
::
sync
::
atomic
::{
AtomicUsize
,
Ordering
};
pub
struct
Id
{
pub
counter
:
AtomicUsize
,
}
impl
Id
{
pub
fn
new
(
start
:
usize
)
->
Self
{
Id
{
counter
:
AtomicUsize
::
new
(
start
)
}
}
pub
fn
next
(
&
self
)
->
usize
{
self
.
counter
.
fetch_add
(
1
,
Ordering
::
SeqCst
)
}
}
pub
struct
Exists
;
impl
Exists
{
pub
fn
folder
(
dir_name
:
String
)
->
Result
<
bool
,
Error
>
{
Ok
(
Path
::
new
(
str
!
(
dir_name
)).
is_dir
())
}
pub
fn
file
(
file_name
:
String
)
->
Result
<
bool
,
Error
>
{
Ok
(
Path
::
new
(
str
!
(
file_name
)).
exists
())
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 15, 6:27 PM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
484871
Default Alt Text
helpers.rs (571 B)
Attached To
Mode
rPMC Process Management Controller
Attached
Detach File
Event Timeline
Log In to Comment