MCPcopy Create free account

hub / github.com/ddimaria/rust-actix-example / functions

Functions100 in github.com/ddimaria/rust-actix-example

↓ 15 callersFunctionget_pool
Returns a r2d2 Pooled Connection to be used in tests
src/tests/helpers.rs:103
↓ 10 callersFunctionfind
Find a user by the user's id or error out
src/models/user.rs:61
↓ 8 callersFunctionget
(data: AppState<'a, T>, key: &'a str)
src/state.rs:28
↓ 7 callersFunctionget_data_pool
Returns a r2d2 Pooled Connection wrappedn in Actix Application Data
src/tests/helpers.rs:108
↓ 7 callersFunctionrespond_json
Helper function to reduce boilerplate of an OK/Json response
src/helpers.rs:6
↓ 5 callersFunctionhash
Encrypt a password Uses the argon2i algorithm. auth_salt is environment-configured.
src/auth.rs:49
↓ 4 callersFunctionapp_state
Mock applicate state
src/tests/helpers.rs:136
↓ 4 callersFunctionassert_get
Assert that a route is successful for HTTP GET requests
src/tests/helpers.rs:89
↓ 4 callersFunctionget_identity
()
src/handlers/auth.rs:61
↓ 4 callersFunctionget_identity_service
Gets the identidy service for injection into an Actix app
src/auth.rs:57
↓ 4 callersFunctionvalidate
Validate a struct and collect and return the errors
src/validate.rs:8
↓ 3 callersFunctioncreate_jwt
Create a json web token (JWT)
src/auth.rs:27
↓ 3 callersFunctiondecode_jwt
Decode a json web token (JWT)
src/auth.rs:38
↓ 3 callersFunctionget
(redis: Cache, key: &'a str)
src/cache.rs:12
↓ 3 callersFunctionget_all
Get all users
src/models/user.rs:51
↓ 3 callersFunctionget_all_users
()
src/handlers/user.rs:157
↓ 3 callersFunctionget_all_users
()
src/models/user.rs:145
↓ 3 callersFunctionget_first_users_id
()
src/handlers/user.rs:162
↓ 3 callersFunctionrespond_ok
Helper function to reduce boilerplate of an empty OK response
src/helpers.rs:14
↓ 3 callersFunctionsend
Send a command to the redis actor
src/cache.rs:32
↓ 3 callersFunctionupdate
Update a user
src/models/user.rs:102
↓ 2 callersFunctionassert_post
Assert that a route is successful for HTTP POST requests
src/tests/helpers.rs:96
↓ 2 callersFunctioncollect_errors
Collect ValidationErrors and return a vector of the messages Adds a default_error when none is supplied
src/validate.rs:20
↓ 2 callersFunctioncreate
Create a new user
src/models/user.rs:93
↓ 2 callersFunctioncreate_user
()
src/models/user.rs:150
↓ 2 callersFunctiondelete
(data: AppState<'a, T>, key: &'a str)
src/state.rs:39
↓ 2 callersFunctiondelete
Delete a user
src/models/user.rs:114
↓ 2 callersFunctionget_cache
()
src/cache.rs:55
↓ 2 callersFunctionget_test_request
()
src/validate.rs:49
↓ 2 callersFunctionget_user
Get a user
src/handlers/user.rs:66
↓ 2 callersFunctionlogin_user
()
src/handlers/auth.rs:71
↓ 2 callersFunctionset
(data: AppState<'a, T>, key: &'a str, value: T)
src/state.rs:20
↓ 2 callersFunctionset
(redis: Cache, key: &'a str, value: &'a str)
src/cache.rs:19
↓ 1 callersFunctioncreate_user
Create a user
src/handlers/user.rs:81
↓ 1 callersFunctiondelete
(redis: Cache, key: &'a str)
src/cache.rs:26
↓ 1 callersFunctiondelete_user
Delete a user
src/handlers/user.rs:126
↓ 1 callersFunctionfind_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 callersFunctionget_config
Use envy to inject dotenv and env vars into the Config struct
src/config.rs:38
↓ 1 callersFunctionget_health
Handler to get the liveness of the service
src/handlers/health.rs:12
↓ 1 callersFunctionget_users
Get all users
src/handlers/user.rs:75
↓ 1 callersFunctioninit_pool
(config: Config)
src/database.rs:66
↓ 1 callersFunctionlogin
Login a user Create and remember their JWT
src/handlers/auth.rs:27
↓ 1 callersFunctionlogin
Login to routes
src/tests/helpers.rs:113
↓ 1 callersFunctionlogout
Logout a user Forget their user_id
src/handlers/auth.rs:49
↓ 1 callersFunctionlogout_user
()
src/handlers/auth.rs:80
↓ 1 callersFunctionserver
()
src/server.rs:13
↓ 1 callersFunctiontest_get
Helper for HTTP GET integration tests
src/tests/helpers.rs:16
↓ 1 callersFunctiontest_post
Helper for HTTP POST integration tests
src/tests/helpers.rs:53
↓ 1 callersFunctionupdate_user
Update a user
src/handlers/user.rs:105
Functionadd_cache
Add the redis actor to actix data if the URL is set
src/cache.rs:43
Functionadd_pool
(cfg: &mut web::ServiceConfig)
src/database.rs:74
Methodcall
(&mut self, req: ServiceRequest)
src/middleware/auth.rs:49
Methoderror_response
(&self)
src/errors.rs:38
Methodfrom
(error: &String)
src/errors.rs:59
Methodfrom
(user: User)
src/handlers/user.rs:135
Methodfrom
(user: NewUser)
src/models/user.rs:125
Methodfrom_request
(req: &HttpRequest, _payload: &mut Payload)
src/extractors.rs:20
Methodinit_pool
(config: Config)
src/database.rs:49
Functionit_collects_errors
()
src/validate.rs:55
Functionit_creates_a_jwt
()
src/auth.rs:87
Functionit_creates_a_user
()
src/handlers/user.rs:192
Functionit_creates_a_user
()
src/tests/user.rs:23
Functionit_creates_a_user
()
src/models/user.rs:187
Functionit_creates_new_application_cache_and_sets_and_reads_it
()
src/cache.rs:61
Functionit_creates_new_application_state_and_sets_and_reads_it
()
src/state.rs:50
Functionit_decodes_a_jwt
()
src/auth.rs:94
Functionit_deletes_a_user
()
src/handlers/user.rs:221
Functionit_deletes_a_user
()
src/models/user.rs:227
Functionit_doesnt_find_a_user
()
src/handlers/user.rs:175
Functionit_doesnt_find_a_user
()
src/models/user.rs:180
Functionit_fails_to_update_a_nonexistent_user
()
src/models/user.rs:213
Functionit_gets_a_config
()
src/config.rs:52
Functionit_gets_a_config_from_the_lazy_static
()
src/config.rs:58
Functionit_gets_a_user
()
src/handlers/user.rs:167
Functionit_gets_a_user
()
src/tests/user.rs:11
Functionit_gets_a_user
()
src/models/user.rs:166
Functionit_gets_all_users
()
src/handlers/user.rs:185
Functionit_gets_all_users
()
src/tests/user.rs:18
Functionit_hashes_a_password
()
src/auth.rs:72
Functionit_logs_a_user_in
()
src/handlers/auth.rs:86
Functionit_logs_a_user_in
()
src/tests/auth.rs:9
Functionit_logs_a_user_out
()
src/handlers/auth.rs:92
Functionit_logs_a_user_out
()
src/tests/auth.rs:19
Functionit_matches_2_hashed_passwords
()
src/auth.rs:79
Functionit_removes_an_entry_in_application_cache
()
src/cache.rs:69
Functionit_removes_an_entry_in_application_state
()
src/state.rs:58
Functionit_responds_json
()
src/helpers.rs:28
Functionit_responds_ok
()
src/helpers.rs:38
Functionit_updates_a_user
()
src/handlers/user.rs:206
Functionit_updates_a_user
()
src/models/user.rs:196
Functionit_validates
()
src/validate.rs:63
Functionmain
()
src/main.rs:32
Methodnew
(user_id: Uuid, email: String)
src/auth.rs:17
Functionnew_state
Create a new state instance and wrap in a mutex. Further wrap into an Actix Data instance.
src/state.rs:11
Methodnew_transform
(&self, service: S)
src/middleware/auth.rs:27
Methodpoll_ready
(&mut self, cx: &mut Context)
src/middleware/auth.rs:45
Functionroutes
(cfg: &mut web::ServiceConfig)
src/routes.rs:13
Functiontest_find
()
src/models/user.rs:172
Functiontest_get_health
()
src/handlers/health.rs:24
Functiontest_health
()
src/tests/health.rs:6