FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
RustedLessPass.github.io/src/settings.rs at main · RustedLessPass/RustedLessPass.github.io · GitHub
RustedLessPass
/
RustedLessPass.github.io
Public
forked from
RustedLessPass/RustedLessPass
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
RustedLessPass.github.io
/
src
/
settings.rs
Copy path
More file actions
More file actions
Latest commit
History
History
History
48 lines (41 loc) · 1.16 KB
Breadcrumbs
RustedLessPass.github.io
/
src
/
settings.rs
Copy path
File metadata and controls
48 lines (41 loc) · 1.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
This module defines a Settings struct for password generation
and implements methods to load and store settings using local storage.
The Settings struct holds parameters such as password length, inclusion
of different character types, and a list of disabled characters.
*/
use
gloo
::
storage
::
{
LocalStorage
,
Storage
}
;
use
serde
::
{
Deserialize
,
Serialize
}
;
// Define a struct to hold settings
#
[
derive
(
Clone
,
Debug
,
PartialEq
,
Deserialize
,
Serialize
)
]
pub
struct
Settings
{
pub
size
:
u64
,
pub
counter
:
u64
,
pub
lowercase
:
u64
,
pub
uppercase
:
u64
,
pub
numbers
:
u64
,
pub
symbols
:
u64
,
pub
disabled
:
String
,
}
impl
Settings
{
const
KEY
:
&
'
static
str
=
"rustedlesspass.rustedlesspass.settings"
;
pub
fn
load
(
)
->
Self
{
LocalStorage
::
get
(
Self
::
KEY
)
.
unwrap_or_default
(
)
}
pub
fn
store
(
&
self
)
{
let
_ =
LocalStorage
::
set
(
Self
::
KEY
,
self
)
;
}
}
impl
Default
for
Settings
{
fn
default
(
)
->
Self
{
Self
{
size
:
16
,
counter
:
1
,
lowercase
:
1
,
uppercase
:
1
,
numbers
:
1
,
symbols
:
1
,
disabled
:
String
::
new
(
)
,
}
}
}
Back
|
FazBrowse Home
|
New Git URL