Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ddimaria/rust-actix-example
/ functions
Functions
100 in github.com/ddimaria/rust-actix-example
⨍
Functions
100
◇
Types & classes
20
↓ 15 callers
Function
get_pool
Returns a r2d2 Pooled Connection to be used in tests
src/tests/helpers.rs:103
↓ 10 callers
Function
find
Find a user by the user's id or error out
src/models/user.rs:61
↓ 8 callers
Function
get
(data: AppState<'a, T>, key: &'a str)
src/state.rs:28
↓ 7 callers
Function
get_data_pool
Returns a r2d2 Pooled Connection wrappedn in Actix Application Data
src/tests/helpers.rs:108
↓ 7 callers
Function
respond_json
Helper function to reduce boilerplate of an OK/Json response
src/helpers.rs:6
↓ 5 callers
Function
hash
Encrypt a password Uses the argon2i algorithm. auth_salt is environment-configured.
src/auth.rs:49
↓ 4 callers
Function
app_state
Mock applicate state
src/tests/helpers.rs:136
↓ 4 callers
Function
assert_get
Assert that a route is successful for HTTP GET requests
src/tests/helpers.rs:89
↓ 4 callers
Function
get_identity
()
src/handlers/auth.rs:61
↓ 4 callers
Function
get_identity_service
Gets the identidy service for injection into an Actix app
src/auth.rs:57
↓ 4 callers
Function
validate
Validate a struct and collect and return the errors
src/validate.rs:8
↓ 3 callers
Function
create_jwt
Create a json web token (JWT)
src/auth.rs:27
↓ 3 callers
Function
decode_jwt
Decode a json web token (JWT)
src/auth.rs:38
↓ 3 callers
Function
get
(redis: Cache, key: &'a str)
src/cache.rs:12
↓ 3 callers
Function
get_all
Get all users
src/models/user.rs:51
↓ 3 callers
Function
get_all_users
()
src/handlers/user.rs:157
↓ 3 callers
Function
get_all_users
()
src/models/user.rs:145
↓ 3 callers
Function
get_first_users_id
()
src/handlers/user.rs:162
↓ 3 callers
Function
respond_ok
Helper function to reduce boilerplate of an empty OK response
src/helpers.rs:14
↓ 3 callers
Function
send
Send a command to the redis actor
src/cache.rs:32
↓ 3 callers
Function
update
Update a user
src/models/user.rs:102
↓ 2 callers
Function
assert_post
Assert that a route is successful for HTTP POST requests
src/tests/helpers.rs:96
↓ 2 callers
Function
collect_errors
Collect ValidationErrors and return a vector of the messages Adds a default_error when none is supplied
src/validate.rs:20
↓ 2 callers
Function
create
Create a new user
src/models/user.rs:93
↓ 2 callers
Function
create_user
()
src/models/user.rs:150
↓ 2 callers
Function
delete
(data: AppState<'a, T>, key: &'a str)
src/state.rs:39
↓ 2 callers
Function
delete
Delete a user
src/models/user.rs:114
↓ 2 callers
Function
get_cache
()
src/cache.rs:55
↓ 2 callers
Function
get_test_request
()
src/validate.rs:49
↓ 2 callers
Function
get_user
Get a user
src/handlers/user.rs:66
↓ 2 callers
Function
login_user
()
src/handlers/auth.rs:71
↓ 2 callers
Function
set
(data: AppState<'a, T>, key: &'a str, value: T)
src/state.rs:20
↓ 2 callers
Function
set
(redis: Cache, key: &'a str, value: &'a str)
src/cache.rs:19
↓ 1 callers
Function
create_user
Create a user
src/handlers/user.rs:81
↓ 1 callers
Function
delete
(redis: Cache, key: &'a str)
src/cache.rs:26
↓ 1 callers
Function
delete_user
Delete a user
src/handlers/user.rs:126
↓ 1 callers
Function
find_by_auth
Find a user by the user's authentication information (email + password) Return an Unauthorized error if it doesn't match
src/models/user.rs:76
↓ 1 callers
Function
get_config
Use envy to inject dotenv and env vars into the Config struct
src/config.rs:38
↓ 1 callers
Function
get_health
Handler to get the liveness of the service
src/handlers/health.rs:12
↓ 1 callers
Function
get_users
Get all users
src/handlers/user.rs:75
↓ 1 callers
Function
init_pool
(config: Config)
src/database.rs:66
↓ 1 callers
Function
login
Login a user Create and remember their JWT
src/handlers/auth.rs:27
↓ 1 callers
Function
login
Login to routes
src/tests/helpers.rs:113
↓ 1 callers
Function
logout
Logout a user Forget their user_id
src/handlers/auth.rs:49
↓ 1 callers
Function
logout_user
()
src/handlers/auth.rs:80
↓ 1 callers
Function
server
()
src/server.rs:13
↓ 1 callers
Function
test_get
Helper for HTTP GET integration tests
src/tests/helpers.rs:16
↓ 1 callers
Function
test_post
Helper for HTTP POST integration tests
src/tests/helpers.rs:53
↓ 1 callers
Function
update_user
Update a user
src/handlers/user.rs:105
Function
add_cache
Add the redis actor to actix data if the URL is set
src/cache.rs:43
Function
add_pool
(cfg: &mut web::ServiceConfig)
src/database.rs:74
Method
call
(&mut self, req: ServiceRequest)
src/middleware/auth.rs:49
Method
error_response
(&self)
src/errors.rs:38
Method
from
(error: &String)
src/errors.rs:59
Method
from
(user: User)
src/handlers/user.rs:135
Method
from
(user: NewUser)
src/models/user.rs:125
Method
from_request
(req: &HttpRequest, _payload: &mut Payload)
src/extractors.rs:20
Method
init_pool
(config: Config)
src/database.rs:49
Function
it_collects_errors
()
src/validate.rs:55
Function
it_creates_a_jwt
()
src/auth.rs:87
Function
it_creates_a_user
()
src/handlers/user.rs:192
Function
it_creates_a_user
()
src/tests/user.rs:23
Function
it_creates_a_user
()
src/models/user.rs:187
Function
it_creates_new_application_cache_and_sets_and_reads_it
()
src/cache.rs:61
Function
it_creates_new_application_state_and_sets_and_reads_it
()
src/state.rs:50
Function
it_decodes_a_jwt
()
src/auth.rs:94
Function
it_deletes_a_user
()
src/handlers/user.rs:221
Function
it_deletes_a_user
()
src/models/user.rs:227
Function
it_doesnt_find_a_user
()
src/handlers/user.rs:175
Function
it_doesnt_find_a_user
()
src/models/user.rs:180
Function
it_fails_to_update_a_nonexistent_user
()
src/models/user.rs:213
Function
it_gets_a_config
()
src/config.rs:52
Function
it_gets_a_config_from_the_lazy_static
()
src/config.rs:58
Function
it_gets_a_user
()
src/handlers/user.rs:167
Function
it_gets_a_user
()
src/tests/user.rs:11
Function
it_gets_a_user
()
src/models/user.rs:166
Function
it_gets_all_users
()
src/handlers/user.rs:185
Function
it_gets_all_users
()
src/tests/user.rs:18
Function
it_hashes_a_password
()
src/auth.rs:72
Function
it_logs_a_user_in
()
src/handlers/auth.rs:86
Function
it_logs_a_user_in
()
src/tests/auth.rs:9
Function
it_logs_a_user_out
()
src/handlers/auth.rs:92
Function
it_logs_a_user_out
()
src/tests/auth.rs:19
Function
it_matches_2_hashed_passwords
()
src/auth.rs:79
Function
it_removes_an_entry_in_application_cache
()
src/cache.rs:69
Function
it_removes_an_entry_in_application_state
()
src/state.rs:58
Function
it_responds_json
()
src/helpers.rs:28
Function
it_responds_ok
()
src/helpers.rs:38
Function
it_updates_a_user
()
src/handlers/user.rs:206
Function
it_updates_a_user
()
src/models/user.rs:196
Function
it_validates
()
src/validate.rs:63
Function
main
()
src/main.rs:32
Method
new
(user_id: Uuid, email: String)
src/auth.rs:17
Function
new_state
Create a new state instance and wrap in a mutex. Further wrap into an Actix Data instance.
src/state.rs:11
Method
new_transform
(&self, service: S)
src/middleware/auth.rs:27
Method
poll_ready
(&mut self, cx: &mut Context)
src/middleware/auth.rs:45
Function
routes
(cfg: &mut web::ServiceConfig)
src/routes.rs:13
Function
test_find
()
src/models/user.rs:172
Function
test_get_health
()
src/handlers/health.rs:24
Function
test_health
()
src/tests/health.rs:6