├── docs ├── api │ ├── .lock │ ├── crates.js │ ├── simple_redis │ │ ├── client │ │ │ ├── sidebar-items.js │ │ │ ├── index.html │ │ │ └── fn.create.html │ │ ├── sidebar-items.js │ │ ├── types │ │ │ ├── sidebar-items.js │ │ │ ├── type.Message.html │ │ │ ├── type.RedisBoolResult.html │ │ │ ├── type.RedisEmptyResult.html │ │ │ ├── type.RedisResult.html │ │ │ ├── type.RedisStringResult.html │ │ │ └── index.html │ │ ├── type.Message.html │ │ ├── all.html │ │ ├── type.RedisError.html │ │ ├── type.RedisResult.html │ │ ├── fn.create.html │ │ └── type.Interrupts.html │ ├── static.files │ │ ├── favicon-32x32-6580c154.png │ │ ├── FiraMono-Medium-86f75c8c.woff2 │ │ ├── FiraMono-Regular-87c26294.woff2 │ │ ├── FiraSans-Italic-81dc35de.woff2 │ │ ├── FiraSans-Medium-e1aa3f0a.woff2 │ │ ├── FiraSans-Regular-0fe48ade.woff2 │ │ ├── FiraSans-MediumItalic-ccf7e434.woff2 │ │ ├── NanumBarunGothic-13b3dcba.ttf.woff2 │ │ ├── SourceCodePro-It-fc8b9304.ttf.woff2 │ │ ├── SourceSerif4-Bold-6d4fd4c0.ttf.woff2 │ │ ├── SourceSerif4-It-ca3b17ed.ttf.woff2 │ │ ├── SourceCodePro-Regular-8badfe75.ttf.woff2 │ │ ├── SourceCodePro-Semibold-aa29a496.ttf.woff2 │ │ ├── SourceSerif4-Regular-6b053e98.ttf.woff2 │ │ ├── SourceSerif4-Semibold-457a13ac.ttf.woff2 │ │ ├── LICENSE-MIT-23f18e03.txt │ │ ├── normalize-9960930a.css │ │ ├── scrape-examples-5e967b76.js │ │ ├── COPYRIGHT-7fb11f4e.txt │ │ ├── rust-logo-9a9549ea.svg │ │ ├── src-script-813739b1.js │ │ ├── favicon-044be391.svg │ │ ├── FiraSans-LICENSE-05ab6dbd.txt │ │ ├── SourceCodePro-LICENSE-67f54ca7.txt │ │ ├── SourceSerif4-LICENSE-a2cfd9d5.md │ │ ├── NanumBarunGothic-LICENSE-a37d393b.txt │ │ ├── storage-68b7e25d.js │ │ ├── settings-5514c975.js │ │ └── noscript-32bb7600.css │ ├── src-files.js │ ├── type.impl │ │ └── simple_redis │ │ │ └── types │ │ │ ├── type.Message.js │ │ │ ├── type.RedisResult.js │ │ │ ├── struct.Interrupts.js │ │ │ └── enum.RedisError.js │ ├── trait.impl │ │ ├── simple_redis │ │ │ └── types │ │ │ │ └── trait.RedisArg.js │ │ └── core │ │ │ ├── error │ │ │ └── trait.Error.js │ │ │ ├── fmt │ │ │ ├── trait.Display.js │ │ │ └── trait.Debug.js │ │ │ ├── clone │ │ │ └── trait.Clone.js │ │ │ ├── marker │ │ │ ├── trait.Copy.js │ │ │ ├── trait.UnsafeUnpin.js │ │ │ ├── trait.Send.js │ │ │ ├── trait.Sync.js │ │ │ ├── trait.Unpin.js │ │ │ └── trait.Freeze.js │ │ │ ├── default │ │ │ └── trait.Default.js │ │ │ └── panic │ │ │ └── unwind_safe │ │ │ ├── trait.UnwindSafe.js │ │ │ └── trait.RefUnwindSafe.js │ ├── settings.html │ ├── help.html │ ├── search.desc │ │ └── simple_redis │ │ │ └── simple_redis-desc-0-.js │ └── search-index.js └── index.html ├── .gitattributes ├── .rusty-hook.toml ├── .gitignore ├── src ├── connection_test.rs ├── subscriber_test.rs ├── lib_test.rs ├── types_test.rs ├── commands_test.rs ├── client_test.rs ├── connection.rs ├── types.rs └── subscriber.rs ├── .github ├── dependabot.yml ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── workflows │ └── ci.yml └── CONTRIBUTING.md ├── .editorconfig ├── benches └── bench_commands.rs ├── examples ├── open_close_connection.rs ├── set_get.rs ├── subscription_flow.rs ├── init_and_simple_operations.rs └── pubsub.rs ├── Makefile.toml ├── Cargo.toml ├── CHANGELOG.md └── tests ├── client_test.rs └── pubsub_test.rs /docs/api/.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | *.ico binary 3 | *.woff binary 4 | -------------------------------------------------------------------------------- /.rusty-hook.toml: -------------------------------------------------------------------------------- 1 | [hooks] 2 | pre-push = "cargo make ci-flow" 3 | -------------------------------------------------------------------------------- /docs/api/crates.js: -------------------------------------------------------------------------------- 1 | window.ALL_CRATES = ["simple_redis"]; 2 | //{"start":21,"fragment_lengths":[14]} -------------------------------------------------------------------------------- /docs/api/simple_redis/client/sidebar-items.js: -------------------------------------------------------------------------------- 1 | window.SIDEBAR_ITEMS = {"fn":["create"],"struct":["Client"]}; -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .c9 3 | /target 4 | temp/ 5 | **/*.rs.bk 6 | Cargo.lock 7 | **/*.log 8 | dump.rdb 9 | /rs*.sh 10 | /docs/_site 11 | /core 12 | -------------------------------------------------------------------------------- /docs/api/static.files/favicon-32x32-6580c154.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/favicon-32x32-6580c154.png -------------------------------------------------------------------------------- /docs/api/simple_redis/sidebar-items.js: -------------------------------------------------------------------------------- 1 | window.SIDEBAR_ITEMS = {"fn":["create"],"mod":["client","types"],"type":["Interrupts","Message","RedisError","RedisResult"]}; -------------------------------------------------------------------------------- /docs/api/static.files/FiraMono-Medium-86f75c8c.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/FiraMono-Medium-86f75c8c.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/FiraMono-Regular-87c26294.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/FiraMono-Regular-87c26294.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/FiraSans-Italic-81dc35de.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/FiraSans-Italic-81dc35de.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/FiraSans-Medium-e1aa3f0a.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/FiraSans-Medium-e1aa3f0a.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/FiraSans-Regular-0fe48ade.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/FiraSans-Regular-0fe48ade.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/FiraSans-MediumItalic-ccf7e434.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/FiraSans-MediumItalic-ccf7e434.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/NanumBarunGothic-13b3dcba.ttf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/NanumBarunGothic-13b3dcba.ttf.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/SourceCodePro-It-fc8b9304.ttf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/SourceCodePro-It-fc8b9304.ttf.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/SourceSerif4-Bold-6d4fd4c0.ttf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/SourceSerif4-Bold-6d4fd4c0.ttf.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/SourceSerif4-It-ca3b17ed.ttf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/SourceSerif4-It-ca3b17ed.ttf.woff2 -------------------------------------------------------------------------------- /src/connection_test.rs: -------------------------------------------------------------------------------- 1 | use super::*; 2 | 3 | #[test] 4 | fn create_check_state() { 5 | let mut connection = create(); 6 | assert!(!connection.is_connection_open()); 7 | } 8 | -------------------------------------------------------------------------------- /docs/api/static.files/SourceCodePro-Regular-8badfe75.ttf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/SourceCodePro-Regular-8badfe75.ttf.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/SourceCodePro-Semibold-aa29a496.ttf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/SourceCodePro-Semibold-aa29a496.ttf.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/SourceSerif4-Regular-6b053e98.ttf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/SourceSerif4-Regular-6b053e98.ttf.woff2 -------------------------------------------------------------------------------- /docs/api/static.files/SourceSerif4-Semibold-457a13ac.ttf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagiegurari/simple_redis/master/docs/api/static.files/SourceSerif4-Semibold-457a13ac.ttf.woff2 -------------------------------------------------------------------------------- /docs/api/src-files.js: -------------------------------------------------------------------------------- 1 | createSrcSidebar('[["simple_redis",["",[],["client.rs","commands.rs","connection.rs","lib.rs","subscriber.rs","types.rs"]]]]'); 2 | //{"start":19,"fragment_lengths":[104]} -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: cargo 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: '03:00' 8 | open-pull-requests-limit: 99 9 | -------------------------------------------------------------------------------- /docs/api/simple_redis/types/sidebar-items.js: -------------------------------------------------------------------------------- 1 | window.SIDEBAR_ITEMS = {"enum":["RedisError"],"struct":["Interrupts"],"trait":["RedisArg"],"type":["Message","RedisBoolResult","RedisEmptyResult","RedisResult","RedisStringResult"]}; -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | indent_style = space 10 | indent_size = 4 11 | 12 | [*.json] 13 | indent_size = 2 14 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/subscriber_test.rs: -------------------------------------------------------------------------------- 1 | use super::*; 2 | 3 | #[test] 4 | fn create_check_state() { 5 | let subscriber = create(); 6 | assert_eq!(subscriber.subscriptions.len(), 0); 7 | assert_eq!(subscriber.psubscriptions.len(), 0); 8 | assert!(subscriber.redis_connection.is_none()); 9 | } 10 | -------------------------------------------------------------------------------- /docs/api/type.impl/simple_redis/types/type.Message.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var type_impls = Object.fromEntries([["simple_redis",[]]]); 3 | if (window.register_type_impls) { 4 | window.register_type_impls(type_impls); 5 | } else { 6 | window.pending_type_impls = type_impls; 7 | } 8 | })() 9 | //{"start":55,"fragment_lengths":[19]} -------------------------------------------------------------------------------- /docs/api/type.impl/simple_redis/types/type.RedisResult.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var type_impls = Object.fromEntries([["simple_redis",[]]]); 3 | if (window.register_type_impls) { 4 | window.register_type_impls(type_impls); 5 | } else { 6 | window.pending_type_impls = type_impls; 7 | } 8 | })() 9 | //{"start":55,"fragment_lengths":[19]} -------------------------------------------------------------------------------- /src/lib_test.rs: -------------------------------------------------------------------------------- 1 | use super::*; 2 | use doc_comment as _; 3 | 4 | #[test] 5 | fn create_invalid_url() { 6 | let result = create("test/bad/url"); 7 | assert!(result.is_err()); 8 | } 9 | 10 | #[test] 11 | fn create_valid_url() { 12 | let mut client = create("redis://127.0.0.1:6379/").unwrap(); 13 | assert!(!client.is_connection_open()); 14 | } 15 | -------------------------------------------------------------------------------- /docs/api/trait.impl/simple_redis/types/trait.RedisArg.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[19]} -------------------------------------------------------------------------------- /src/types_test.rs: -------------------------------------------------------------------------------- 1 | use super::*; 2 | use std::io::Write; 3 | 4 | #[test] 5 | fn redis_error_description() { 6 | let redis_error = RedisError::Description("test"); 7 | 8 | assert_eq!(redis_error.to_string(), "test"); 9 | 10 | let mut writer = Vec::new(); 11 | write!(&mut writer, "formatted {}", redis_error).unwrap(); 12 | assert_eq!(writer, b"formatted test"); 13 | } 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: sagiegurari 7 | 8 | --- 9 | 10 | ### Feature Description 11 | 12 | 13 | ### Describe The Solution You'd Like 14 | 15 | 16 | ### Code Sample 17 | 18 | ```rust 19 | /// paste code here 20 | ``` 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: sagiegurari 7 | 8 | --- 9 | 10 | ### Describe The Bug 11 | 12 | 13 | ### To Reproduce 14 | 15 | 16 | ### Error Stack 17 | 18 | ```console 19 | The error stack trace 20 | ``` 21 | 22 | ### Code Sample 23 | 24 | ```rust 25 | /// paste code here 26 | ``` 27 | -------------------------------------------------------------------------------- /docs/api/trait.impl/core/error/trait.Error.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl Error for RedisError"]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[294]} -------------------------------------------------------------------------------- /docs/api/trait.impl/core/fmt/trait.Display.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl Display for RedisError"]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[296]} -------------------------------------------------------------------------------- /docs/api/trait.impl/core/clone/trait.Clone.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl Clone for Interrupts"]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[300]} -------------------------------------------------------------------------------- /docs/api/trait.impl/core/marker/trait.Copy.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl Copy for Interrupts"]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[299]} -------------------------------------------------------------------------------- /docs/api/trait.impl/core/default/trait.Default.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl Default for Interrupts"]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[310]} -------------------------------------------------------------------------------- /benches/bench_commands.rs: -------------------------------------------------------------------------------- 1 | #![feature(test)] 2 | extern crate simple_redis; 3 | extern crate test; 4 | 5 | use test::Bencher; 6 | 7 | #[bench] 8 | fn set_get_del(bencher: &mut Bencher) { 9 | let mut client = simple_redis::create("redis://127.0.0.1:6379/").unwrap(); 10 | 11 | client.set("bnch_set_get", "my_value").unwrap(); 12 | client.get_string("bnch_set_get").unwrap(); 13 | client.del("bnch_set_get").unwrap(); 14 | 15 | assert!(client.is_connection_open()); 16 | 17 | bencher.iter(|| { 18 | client.set("bnch_set_get", "my_value").unwrap(); 19 | client.get_string("bnch_set_get").unwrap(); 20 | client.del("bnch_set_get").unwrap(); 21 | }); 22 | } 23 | -------------------------------------------------------------------------------- /examples/open_close_connection.rs: -------------------------------------------------------------------------------- 1 | use simple_redis; 2 | 3 | fn main() { 4 | match simple_redis::create("redis://127.0.0.1:6379/") { 5 | Ok(mut client) => { 6 | println!("Created Redis Client"); 7 | 8 | match client.set("my_key", "my_value") { 9 | Err(error) => println!("Unable to set value in Redis: {}", error), 10 | _ => println!("Value set in Redis"), 11 | }; 12 | 13 | match client.quit() { 14 | Err(error) => println!("Error: {}", error), 15 | _ => println!("Connection Closed."), 16 | } 17 | } 18 | Err(error) => println!("Unable to create Redis client: {}", error), 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Makefile.toml: -------------------------------------------------------------------------------- 1 | 2 | [config] 3 | additional_profiles = [ 4 | "all-default-tasks", 5 | "docs-all-modification-tasks", 6 | "ci-coverage-tasks", 7 | "ci-all-build-tasks", 8 | "ci-static-code-analysis-tasks", 9 | "publish-pre-cleanup", 10 | ] 11 | 12 | [tasks.start-redis] 13 | dependencies = ["stop-redis"] 14 | script = ''' 15 | echo "Starting Redis" 16 | redis-server --loglevel warning & 17 | sleep 1 18 | ''' 19 | 20 | [tasks.stop-redis] 21 | script = ''' 22 | echo "Stopping any running Redis" 23 | ps -ef | grep [r]edis-server | awk '{print $2}' | xargs kill -9 || true 24 | ''' 25 | 26 | [tasks.pre-test] 27 | condition = { env_false = ['CARGO_MAKE_CI'] } 28 | run_task = "start-redis" 29 | 30 | [tasks.post-test] 31 | condition = { env_false = ['CARGO_MAKE_CI'] } 32 | run_task = "stop-redis" 33 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [push, pull_request] 3 | env: 4 | CLICOLOR_FORCE: 1 5 | jobs: 6 | ci: 7 | name: CI 8 | runs-on: ${{ matrix.os }} 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | rust: [stable, beta, nightly] 13 | os: [ubuntu-latest, macOS-latest] 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v4 17 | - name: Install rust 18 | uses: dtolnay/rust-toolchain@master 19 | with: 20 | toolchain: ${{ matrix.rust }} 21 | - name: Install cargo-make 22 | run: cargo install --debug cargo-make 23 | - name: Startup Redis 24 | uses: shogo82148/actions-setup-redis@v1 25 | with: 26 | redis-version: '5.x' 27 | - name: Run CI 28 | env: 29 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 30 | run: cargo make ci-flow 31 | -------------------------------------------------------------------------------- /docs/api/trait.impl/core/fmt/trait.Debug.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl Debug for RedisError"],["impl Debug for Interrupts"]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[568]} -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "simple_redis" 3 | version = "0.6.5" 4 | authors = ["Sagie Gur-Ari "] 5 | description = "Simple and resilient redis client." 6 | license = "Apache-2.0" 7 | edition = "2021" 8 | documentation = "https://sagiegurari.github.io/simple_redis/api/simple_redis/index.html" 9 | homepage = "http://github.com/sagiegurari/simple_redis" 10 | repository = "https://github.com/sagiegurari/simple_redis.git" 11 | readme = "README.md" 12 | keywords = ["redis", "cache", "pubsub", "database"] 13 | categories = ["caching", "database"] 14 | include = [ 15 | "/benches/*", 16 | "/docs/*", 17 | "/examples/*", 18 | "/src/*", 19 | "/tests/*", 20 | "/Cargo.toml", 21 | "/LICENSE", 22 | "/README.md", 23 | "/Makefile.toml", 24 | ] 25 | 26 | [dependencies] 27 | redis = { version = "^0.32", default-features = false } 28 | 29 | [dev-dependencies] 30 | doc-comment = "^0.3" 31 | -------------------------------------------------------------------------------- /docs/api/trait.impl/core/marker/trait.UnsafeUnpin.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl UnsafeUnpin for RedisError",1,["simple_redis::types::RedisError"]],["impl UnsafeUnpin for Client",1,["simple_redis::client::Client"]],["impl UnsafeUnpin for Interrupts",1,["simple_redis::types::Interrupts"]]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[593]} -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution Guidelines 2 | 3 | 4 | ## Issues 5 | 6 | Found a bug? Got a question? Want some enhancement?
7 | First place to go is the repository issues section, and I'll try to help as much as possible. 8 | 9 | ## Pull Requests 10 | 11 | Fixed a bug or just want to provided additional functionality?
12 | Simply fork this repository, implement your changes and create a pull request.
13 | Few guidelines regarding pull requests: 14 | 15 | * This repository is integrated with github actions for continuous integration.
16 | 17 | Your pull request build must pass (the build will run automatically).
18 | You can run the following command locally to ensure the build will pass: 19 | 20 | ````sh 21 | cargo make ci-flow 22 | ```` 23 | 24 | * There are many automatic unit tests as part of the library which provide full coverage of the functionality.
Any fix/enhancement must come with a set of tests to ensure it's working well. 25 | -------------------------------------------------------------------------------- /docs/api/static.files/LICENSE-MIT-23f18e03.txt: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any 2 | person obtaining a copy of this software and associated 3 | documentation files (the "Software"), to deal in the 4 | Software without restriction, including without 5 | limitation the rights to use, copy, modify, merge, 6 | publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software 8 | is furnished to do so, subject to the following 9 | conditions: 10 | 11 | The above copyright notice and this permission notice 12 | shall be included in all copies or substantial portions 13 | of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 16 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 17 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 18 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 19 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 22 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /src/commands_test.rs: -------------------------------------------------------------------------------- 1 | use crate::client; 2 | 3 | #[test] 4 | fn create_invalid_url() { 5 | let result = client::create("test/bad/url"); 6 | assert!(result.is_err()); 7 | } 8 | 9 | #[test] 10 | fn create_valid_url() { 11 | let mut client = client::create("redis://127.0.0.1:6379/").unwrap(); 12 | assert!(!client.is_connection_open()); 13 | } 14 | 15 | #[test] 16 | fn run_command() { 17 | let mut client = client::create("redis://127.0.0.1:6379/").unwrap(); 18 | assert!(!client.is_connection_open()); 19 | 20 | let value = client 21 | .run_command::("ECHO", vec!["testing"]) 22 | .unwrap(); 23 | assert_eq!(value, "testing"); 24 | 25 | assert!(client.is_connection_open()); 26 | } 27 | 28 | #[test] 29 | fn set_get() { 30 | let mut client = client::create("redis://127.0.0.1:6379/").unwrap(); 31 | 32 | assert!(!client.is_connection_open()); 33 | 34 | let result = client.set("set_get", "my_value"); 35 | assert!(result.is_ok()); 36 | 37 | assert!(client.is_connection_open()); 38 | 39 | let value = client.get_string("set_get").unwrap(); 40 | assert_eq!(value, "my_value"); 41 | } 42 | -------------------------------------------------------------------------------- /src/client_test.rs: -------------------------------------------------------------------------------- 1 | use super::*; 2 | 3 | #[test] 4 | fn create_invalid_url() { 5 | let result = create("test/bad/url"); 6 | assert!(result.is_err()); 7 | } 8 | 9 | #[test] 10 | fn create_valid_url() { 11 | let mut client = create("redis://127.0.0.1:6379/").unwrap(); 12 | assert!(!client.is_connection_open()); 13 | } 14 | 15 | #[test] 16 | fn run_command() { 17 | let mut client = create("redis://127.0.0.1:6379/").unwrap(); 18 | assert!(!client.is_connection_open()); 19 | 20 | let value = client 21 | .run_command::("ECHO", vec!["testing"]) 22 | .unwrap(); 23 | assert_eq!(value, "testing"); 24 | 25 | assert!(client.is_connection_open()); 26 | } 27 | 28 | #[test] 29 | fn run_command_typed_response() { 30 | let mut client = create("redis://127.0.0.1:6379/").unwrap(); 31 | assert!(!client.is_connection_open()); 32 | 33 | let result = client.run_command_empty_response("SET", vec!["client_test1", "my_value"]); 34 | assert!(result.is_ok()); 35 | 36 | assert!(client.is_connection_open()); 37 | 38 | let value = client 39 | .run_command_string_response("GET", vec!["client_test1"]) 40 | .unwrap(); 41 | assert_eq!(value, "my_value"); 42 | } 43 | -------------------------------------------------------------------------------- /docs/api/trait.impl/core/marker/trait.Send.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl Send for RedisError",1,["simple_redis::types::RedisError"]],["impl Send for Client",1,["simple_redis::client::Client"]],["impl Send for Interrupts",1,["simple_redis::types::Interrupts"]]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[956]} -------------------------------------------------------------------------------- /docs/api/trait.impl/core/marker/trait.Sync.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl Sync for RedisError",1,["simple_redis::types::RedisError"]],["impl Sync for Client",1,["simple_redis::client::Client"]],["impl Sync for Interrupts",1,["simple_redis::types::Interrupts"]]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[956]} -------------------------------------------------------------------------------- /docs/api/trait.impl/core/marker/trait.Unpin.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl Unpin for RedisError",1,["simple_redis::types::RedisError"]],["impl Unpin for Client",1,["simple_redis::client::Client"]],["impl Unpin for Interrupts",1,["simple_redis::types::Interrupts"]]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[965]} -------------------------------------------------------------------------------- /docs/api/trait.impl/core/marker/trait.Freeze.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl Freeze for RedisError",1,["simple_redis::types::RedisError"]],["impl Freeze for Client",1,["simple_redis::client::Client"]],["impl Freeze for Interrupts",1,["simple_redis::types::Interrupts"]]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[974]} -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## CHANGELOG 2 | 3 | ### v0.6.5 (2025-10-14) 4 | 5 | * Maintanence redis-rs to 0.32 6 | 7 | ### v0.6.4 (2024-07-29) 8 | 9 | * Upgrade redis-rs to 0.26 10 | 11 | ### v0.6.3 (2024-03-15) 12 | 13 | * Upgrade redis-rs to 0.25 14 | 15 | ### v0.6.2 (2023-04-23) 16 | 17 | * Upgrade redis-rs to 0.23 18 | 19 | ### v0.6.1 (2021-07-23) 20 | 21 | * Upgrade redis-rs to 0.21 22 | 23 | ### v0.6.0 (2021-03-09) 24 | 25 | * Make errors chainable. 26 | * Upgrade redis-rs to 0.20 27 | 28 | ### v0.5.5 (2020-12-31) 29 | 30 | * Upgrade redis-rs to 0.19 31 | 32 | ### v0.5.4 (2020-12-15) 33 | 34 | * Add zadd and zrange commands #18 35 | 36 | ### v0.5.3 (2020-12-04) 37 | 38 | * Upgrade redis-rs to 0.18 39 | 40 | ### v0.5.2 (2020-07-30) 41 | 42 | * Upgrade redis-rs to 0.17 43 | 44 | ### v0.5.1 (2020-05-11) 45 | 46 | * Upgrade redis-rs to 0.16 47 | 48 | ### v0.5.0 (2020-04-11) 49 | 50 | * Redesigned pubsub api 51 | 52 | ### v0.4.0 (2020-04-10) 53 | 54 | * Upgrade redis-rs to 0.15 55 | 56 | ### v0.3.9 (2017-06-16) 57 | 58 | * More commands added. 59 | 60 | ### v0.3.1 (2017-06-10) 61 | 62 | * Added timeout support for get_message. 63 | 64 | ### v0.2.8 (2017-06-08) 65 | 66 | * More commands added. 67 | 68 | ### v0.1.7 (2017-06-03) 69 | 70 | * pubsub support added. 71 | 72 | ### v0.1.6 (2017-06-02) 73 | 74 | * Initial release 75 | -------------------------------------------------------------------------------- /docs/api/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl !UnwindSafe for RedisError",1,["simple_redis::types::RedisError"]],["impl !UnwindSafe for Client",1,["simple_redis::client::Client"]],["impl UnwindSafe for Interrupts",1,["simple_redis::types::Interrupts"]]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[1081]} -------------------------------------------------------------------------------- /docs/api/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var implementors = Object.fromEntries([["simple_redis",[["impl !RefUnwindSafe for RedisError",1,["simple_redis::types::RedisError"]],["impl !RefUnwindSafe for Client",1,["simple_redis::client::Client"]],["impl RefUnwindSafe for Interrupts",1,["simple_redis::types::Interrupts"]]]]]); 3 | if (window.register_implementors) { 4 | window.register_implementors(implementors); 5 | } else { 6 | window.pending_implementors = implementors; 7 | } 8 | })() 9 | //{"start":57,"fragment_lengths":[1108]} -------------------------------------------------------------------------------- /examples/set_get.rs: -------------------------------------------------------------------------------- 1 | use simple_redis; 2 | use std::{thread, time}; 3 | 4 | fn main() { 5 | match simple_redis::create("redis://127.0.0.1:6379/") { 6 | Ok(mut client) => { 7 | println!("Created Redis Client"); 8 | 9 | match client.set("my_key", "my_value") { 10 | Err(error) => println!("Unable to set value in Redis: {}", error), 11 | _ => println!("Value set in Redis"), 12 | } 13 | 14 | // get the value as string 15 | match client.get_string("my_key") { 16 | Ok(value) => println!("Read value from Redis: {}", value), 17 | Err(error) => println!("Unable to get value from Redis: {}", error), 18 | } 19 | 20 | println!("going to sleep, you can restart redis to test connection resiliency..."); 21 | thread::sleep(time::Duration::from_secs(10)); 22 | println!("back..."); 23 | 24 | match client.set("my_key", 500) { 25 | Err(error) => println!("Unable to set value in Redis: {}", error), 26 | _ => println!("Value set in Redis"), 27 | } 28 | 29 | // get the value as i64 30 | match client.get::("my_key") { 31 | Ok(value) => println!("Read value from Redis: {}", value), 32 | Err(error) => println!("Unable to get value from Redis: {}", error), 33 | } 34 | } 35 | Err(error) => println!("Unable to create Redis client: {}", error), 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/subscription_flow.rs: -------------------------------------------------------------------------------- 1 | use simple_redis; 2 | use simple_redis::{Interrupts, Message}; 3 | 4 | fn main() { 5 | match simple_redis::create("redis://127.0.0.1:6379/") { 6 | Ok(mut client) => { 7 | println!("Created Redis Client"); 8 | 9 | let mut result = client.subscribe("important_notifications"); 10 | assert!(result.is_ok()); 11 | result = client.psubscribe("*_notifications"); 12 | assert!(result.is_ok()); 13 | 14 | // fetch messages from all subscriptions 15 | let mut polling_counter: usize = 0; 16 | client 17 | .fetch_messages( 18 | &mut |message: Message| -> bool { 19 | let payload: String = message.get_payload().unwrap(); 20 | println!("Got message: {}", payload); 21 | 22 | // continue fetching 23 | false 24 | }, 25 | // interrupts enable you to break the fetching blocking call 26 | &mut || -> Interrupts { 27 | let mut interrupts = Interrupts::new(); 28 | interrupts.next_polling_time = Some(150); 29 | 30 | polling_counter = polling_counter + 1; 31 | if polling_counter > 3 { 32 | interrupts.stop = true; 33 | } 34 | 35 | interrupts 36 | }, 37 | ) 38 | .unwrap(); 39 | } 40 | Err(error) => println!("Unable to create Redis client: {}", error), 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /docs/api/static.files/normalize-9960930a.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ 2 | html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} -------------------------------------------------------------------------------- /examples/init_and_simple_operations.rs: -------------------------------------------------------------------------------- 1 | use simple_redis; 2 | 3 | fn main() { 4 | match simple_redis::create("redis://127.0.0.1:6379/") { 5 | Ok(mut client) => { 6 | println!("Created Redis Client"); 7 | 8 | match client.set("my_key", "my_value") { 9 | Err(error) => println!("Unable to set value in Redis: {}", error), 10 | _ => println!("Value set in Redis"), 11 | }; 12 | 13 | match client.get_string("my_key") { 14 | Ok(value) => println!("Read value from Redis: {}", value), 15 | Err(error) => println!("Unable to get value from Redis: {}", error), 16 | }; 17 | 18 | match client.set("my_numeric_key", 255.5) { 19 | Err(error) => println!("Unable to set value in Redis: {}", error), 20 | _ => println!("Value set in Redis"), 21 | }; 22 | 23 | match client.get::("my_numeric_key") { 24 | Ok(value) => println!("Read value from Redis: {}", value), 25 | Err(error) => println!("Unable to get value from Redis: {}", error), 26 | }; 27 | 28 | match client.hgetall("my_map") { 29 | Ok(map) => match map.get("my_field") { 30 | Some(value) => println!("Got field value from map: {}", value), 31 | None => println!("Map field is empty"), 32 | }, 33 | Err(error) => println!("Unable to read map from Redis: {}", error), 34 | }; 35 | 36 | // run some command that is not built in the library 37 | match client.run_command::("ECHO", vec!["testing"]) { 38 | Ok(value) => assert_eq!(value, "testing"), 39 | _ => panic!("test error"), 40 | }; 41 | 42 | // publish messages 43 | let result = client.publish("news_channel", "test message"); 44 | assert!(result.is_ok()); 45 | } 46 | Err(error) => println!("Unable to create Redis client: {}", error), 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/connection.rs: -------------------------------------------------------------------------------- 1 | //! # commands 2 | //! 3 | //! Manages the redis connection and ensures it is valid. 4 | //! 5 | 6 | #[cfg(test)] 7 | #[path = "./connection_test.rs"] 8 | mod connection_test; 9 | 10 | use crate::types::{RedisEmptyResult, RedisError, RedisResult}; 11 | 12 | /// The redis client which enables to invoke redis operations. 13 | pub(crate) struct Connection { 14 | /// Holds the current redis connection 15 | connection: Option, 16 | } 17 | 18 | /// If the client connection is not open or not valid, this function will create 19 | /// a new redis connection and modify the client to store this new connection. 20 | fn open_connection(connection: &mut Connection, client: &redis::Client) -> RedisEmptyResult { 21 | let output: RedisEmptyResult; 22 | 23 | if !connection.is_connection_open() { 24 | output = match client.get_connection() { 25 | Ok(redis_connection) => { 26 | connection.connection = Some(redis_connection); 27 | Ok(()) 28 | } 29 | Err(error) => Err(RedisError::RedisError(error)), 30 | } 31 | } else { 32 | output = Ok(()); 33 | } 34 | 35 | output 36 | } 37 | 38 | impl Connection { 39 | /// Returns true if the currently stored connection is valid, otherwise false.
40 | /// There is no need to call this function as any redis operation invocation will 41 | /// ensure a valid connection is created. 42 | pub(crate) fn is_connection_open(self: &mut Connection) -> bool { 43 | let open; 44 | 45 | match self.connection { 46 | Some(ref mut redis_connection) => { 47 | let result: redis::RedisResult<()> = redis::cmd("PING").query(redis_connection); 48 | 49 | open = result.is_ok(); 50 | } 51 | None => open = false, 52 | } 53 | 54 | open 55 | } 56 | 57 | pub(crate) fn get_redis_connection( 58 | self: &mut Connection, 59 | client: &redis::Client, 60 | ) -> RedisResult<&mut redis::Connection> { 61 | match open_connection(self, client) { 62 | Err(error) => Err(error), 63 | _ => match self.connection { 64 | Some(ref mut redis_connection) => Ok(redis_connection), 65 | None => Err(RedisError::Description("Redis connection not available.")), 66 | }, 67 | } 68 | } 69 | } 70 | 71 | /// Creates and returns a new connection 72 | pub(crate) fn create() -> Connection { 73 | Connection { connection: None } 74 | } 75 | -------------------------------------------------------------------------------- /src/types.rs: -------------------------------------------------------------------------------- 1 | //! # types 2 | //! 3 | //! Defines the various types and aliases used or exposed by the simple_redis library. 4 | //! 5 | 6 | #[cfg(test)] 7 | #[path = "./types_test.rs"] 8 | mod types_test; 9 | 10 | use std::error::Error; 11 | use std::fmt; 12 | use std::fmt::Display; 13 | 14 | #[derive(Debug)] 15 | /// Holds the error information 16 | pub enum RedisError { 17 | /// Root redis error 18 | RedisError(redis::RedisError), 19 | /// Description text of the error reason 20 | Description(&'static str), 21 | } 22 | 23 | impl Display for RedisError { 24 | /// Formats the value using the given formatter. 25 | fn fmt(&self, format: &mut fmt::Formatter) -> Result<(), fmt::Error> { 26 | match self { 27 | Self::RedisError(ref cause) => cause.fmt(format), 28 | Self::Description(description) => description.fmt(format), 29 | } 30 | } 31 | } 32 | 33 | impl Error for RedisError { 34 | fn source(&self) -> Option<&(dyn Error + 'static)> { 35 | match self { 36 | Self::RedisError(error) => Some(error), 37 | Self::Description(_) => None, 38 | } 39 | } 40 | } 41 | 42 | /// Defines a redis command argument 43 | pub trait RedisArg: Sized + ToString {} 44 | 45 | macro_rules! as_redis_arg { 46 | ($t:ty) => { 47 | impl RedisArg for $t {} 48 | }; 49 | } 50 | 51 | impl<'a> RedisArg for &'a str {} 52 | 53 | as_redis_arg!(u8); 54 | as_redis_arg!(i8); 55 | as_redis_arg!(i16); 56 | as_redis_arg!(u16); 57 | as_redis_arg!(i32); 58 | as_redis_arg!(u32); 59 | as_redis_arg!(i64); 60 | as_redis_arg!(u64); 61 | as_redis_arg!(i128); 62 | as_redis_arg!(u128); 63 | as_redis_arg!(f32); 64 | as_redis_arg!(f64); 65 | as_redis_arg!(isize); 66 | as_redis_arg!(usize); 67 | as_redis_arg!(bool); 68 | 69 | /// PubSub message 70 | pub type Message = redis::Msg; 71 | 72 | /// Redis result which either holds a value or a Redis error 73 | pub type RedisResult = Result; 74 | 75 | /// Holds empty result or error 76 | pub type RedisEmptyResult = RedisResult<()>; 77 | 78 | /// Holds string result or error 79 | pub type RedisStringResult = RedisResult; 80 | 81 | /// Holds bool result or error 82 | pub type RedisBoolResult = RedisResult; 83 | 84 | #[derive(Debug, Clone, Copy, Default)] 85 | /// Enable to modify blocking operations. 86 | pub struct Interrupts { 87 | /// Notify blocking operation to stop 88 | pub stop: bool, 89 | /// Next polling time in millies 90 | pub next_polling_time: Option, 91 | } 92 | 93 | impl Interrupts { 94 | /// Returns a new instance. 95 | pub fn new() -> Interrupts { 96 | Default::default() 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /docs/api/settings.html: -------------------------------------------------------------------------------- 1 | Settings

Rustdoc settings

Back
-------------------------------------------------------------------------------- /docs/api/help.html: -------------------------------------------------------------------------------- 1 | Help

Rustdoc help

Back
-------------------------------------------------------------------------------- /docs/api/static.files/scrape-examples-5e967b76.js: -------------------------------------------------------------------------------- 1 | "use strict";(function(){const DEFAULT_MAX_LINES=5;const HIDDEN_MAX_LINES=10;function scrollToLoc(elt,loc,isHidden){const lines=elt.querySelectorAll("[data-nosnippet]");let scrollOffset;const maxLines=isHidden?HIDDEN_MAX_LINES:DEFAULT_MAX_LINES;if(loc[1]-loc[0]>maxLines){const line=Math.max(0,loc[0]-1);scrollOffset=lines[line].offsetTop;}else{const halfHeight=elt.offsetHeight/2;const offsetTop=lines[loc[0]].offsetTop;const lastLine=lines[loc[1]];const offsetBot=lastLine.offsetTop+lastLine.offsetHeight;const offsetMid=(offsetTop+offsetBot)/2;scrollOffset=offsetMid-halfHeight;}lines[0].parentElement.scrollTo(0,scrollOffset);elt.querySelector(".rust").scrollTo(0,scrollOffset);}function createScrapeButton(parent,className,content){const button=document.createElement("button");button.className=className;button.title=content;parent.insertBefore(button,parent.firstChild);return button;}window.updateScrapedExample=(example,buttonHolder)=>{let locIndex=0;const highlights=Array.prototype.slice.call(example.querySelectorAll(".highlight"));const link=example.querySelector(".scraped-example-title a");let expandButton=null;if(!example.classList.contains("expanded")){expandButton=createScrapeButton(buttonHolder,"expand","Show all");}const isHidden=example.parentElement.classList.contains("more-scraped-examples");const locs=example.locs;if(locs.length>1){const next=createScrapeButton(buttonHolder,"next","Next usage");const prev=createScrapeButton(buttonHolder,"prev","Previous usage");const onChangeLoc=changeIndex=>{removeClass(highlights[locIndex],"focus");changeIndex();scrollToLoc(example,locs[locIndex][0],isHidden);addClass(highlights[locIndex],"focus");const url=locs[locIndex][1];const title=locs[locIndex][2];link.href=url;link.innerHTML=title;};prev.addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex-1+locs.length)%locs.length;});});next.addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex+1)%locs.length;});});}if(expandButton){expandButton.addEventListener("click",()=>{if(hasClass(example,"expanded")){removeClass(example,"expanded");removeClass(expandButton,"collapse");expandButton.title="Show all";scrollToLoc(example,locs[0][0],isHidden);}else{addClass(example,"expanded");addClass(expandButton,"collapse");expandButton.title="Show single example";}});}};function setupLoc(example,isHidden){example.locs=JSON.parse(example.attributes.getNamedItem("data-locs").textContent);scrollToLoc(example,example.locs[0][0],isHidden);}const firstExamples=document.querySelectorAll(".scraped-example-list > .scraped-example");onEachLazy(firstExamples,el=>setupLoc(el,false));onEachLazy(document.querySelectorAll(".more-examples-toggle"),toggle=>{onEachLazy(toggle.querySelectorAll(".toggle-line, .hide-more"),button=>{button.addEventListener("click",()=>{toggle.open=false;});});const moreExamples=toggle.querySelectorAll(".scraped-example");toggle.querySelector("summary").addEventListener("click",()=>{setTimeout(()=>{onEachLazy(moreExamples,el=>setupLoc(el,true));});},{once:true});});})(); -------------------------------------------------------------------------------- /docs/api/static.files/COPYRIGHT-7fb11f4e.txt: -------------------------------------------------------------------------------- 1 | # REUSE-IgnoreStart 2 | 3 | These documentation pages include resources by third parties. This copyright 4 | file applies only to those resources. The following third party resources are 5 | included, and carry their own copyright notices and license terms: 6 | 7 | * Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2): 8 | 9 | Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ 10 | with Reserved Font Name Fira Sans. 11 | 12 | Copyright (c) 2014, Telefonica S.A. 13 | 14 | Licensed under the SIL Open Font License, Version 1.1. 15 | See FiraSans-LICENSE.txt. 16 | 17 | * rustdoc.css, main.js, and playpen.js: 18 | 19 | Copyright 2015 The Rust Developers. 20 | Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or 21 | the MIT license (LICENSE-MIT.txt) at your option. 22 | 23 | * normalize.css: 24 | 25 | Copyright (c) Nicolas Gallagher and Jonathan Neal. 26 | Licensed under the MIT license (see LICENSE-MIT.txt). 27 | 28 | * Source Code Pro (SourceCodePro-Regular.ttf.woff2, 29 | SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2): 30 | 31 | Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), 32 | with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark 33 | of Adobe Systems Incorporated in the United States and/or other countries. 34 | 35 | Licensed under the SIL Open Font License, Version 1.1. 36 | See SourceCodePro-LICENSE.txt. 37 | 38 | * Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, 39 | SourceSerif4-It.ttf.woff2, SourceSerif4-Semibold.ttf.woff2): 40 | 41 | Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 42 | 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United 43 | States and/or other countries. 44 | 45 | Licensed under the SIL Open Font License, Version 1.1. 46 | See SourceSerif4-LICENSE.md. 47 | 48 | * Nanum Barun Gothic Font (NanumBarunGothic.woff2) 49 | 50 | Copyright 2010, NAVER Corporation (http://www.nhncorp.com) 51 | with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, 52 | NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, 53 | Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, 54 | Naver NanumMyeongjoEco, NanumMyeongjoEco, Naver NanumGothicLight, 55 | NanumGothicLight, NanumBarunGothic, Naver NanumBarunGothic. 56 | 57 | https://hangeul.naver.com/2017/nanum 58 | https://github.com/hiun/NanumBarunGothic 59 | 60 | Licensed under the SIL Open Font License, Version 1.1. 61 | See NanumBarunGothic-LICENSE.txt. 62 | 63 | * Rust logos (rust-logo.svg, favicon.svg, favicon-32x32.png) 64 | 65 | Copyright 2025 Rust Foundation. 66 | Licensed under the Creative Commons Attribution license (CC-BY). 67 | https://rustfoundation.org/policy/rust-trademark-policy/ 68 | 69 | This copyright file is intended to be distributed with rustdoc output. 70 | 71 | # REUSE-IgnoreEnd 72 | -------------------------------------------------------------------------------- /docs/api/simple_redis/type.Message.html: -------------------------------------------------------------------------------- 1 | Message in simple_redis - Rust

Type Alias Message

Source
pub type Message = Message;
Expand description

PubSub message

2 |

Aliased Type§

pub struct Message { /* private fields */ }
-------------------------------------------------------------------------------- /docs/api/simple_redis/types/type.Message.html: -------------------------------------------------------------------------------- 1 | Message in simple_redis::types - Rust

Type Alias Message

Source
pub type Message = Msg;
Expand description

PubSub message

2 |

Aliased Type§

pub struct Message { /* private fields */ }
-------------------------------------------------------------------------------- /docs/api/static.files/rust-logo-9a9549ea.svg: -------------------------------------------------------------------------------- 1 | 2 | 61 | 62 | -------------------------------------------------------------------------------- /docs/api/search.desc/simple_redis/simple_redis-desc-0-.js: -------------------------------------------------------------------------------- 1 | searchState.loadedDescShard("simple_redis", 0, "simple_redis\nDescription text of the error reason\nContains the error value\nBlocking operations interrupts\nPubSub message\nContains the success value\nError Type\nRoot redis error\nRedis result which either holds a value or a Redis error\nclient\nConstructs a new redis client. The redis connection string …\nNext polling time in millies\nNotify blocking operation to stop\ntypes\nThe redis client which enables to invoke redis operations.\nSee redis APPEND command.\nSee redis AUTH command.\nConstructs a new redis client. The redis connection string …\nSee redis DEL command.\nSee redis ECHO command.\nSee redis EXISTS command.\nSee redis EXPIRE command.\nFetches the messages from any of the subscribed channels …\nReturns the argument unchanged.\nSee redis GET command.\nSee redis GET command. This function will always return a …\nSee redis GETSET command.\nSee redis GETSET command.\nSee redis HDEL command.\nSee redis HEXISTS command.\nSee redis HGET command.\nSee redis HGET command.\nSee redis HGETALL command.\nSee redis HKEYS command.\nSee redis HSET command.\nSee redis HSETNX command.\nSee redis HVALS command.\nSee redis INCR command.\nSee redis INCRBY command.\nSee redis INCRBYFLOAT command.\nCalls U::from(self).\nReturns true if the currently stored connection is valid, …\nReturns true if subscribed to the provided channel pattern.\nReturns true if subscribed to the provided channel.\nSee redis KEYS command.\nSee redis HGET command.\nSee redis HGET command.\nSee redis LLEN command.\nSee redis LPOP command.\nSee redis LPUSH command.\nSee redis LPUSHX command.\nSee redis LRANGE command.\nSee redis LREM command.\nSee redis LSET command.\nSee redis LTRIM command.\nSee redis PERSIST command.\nSee redis PEXPIRE command.\nSubscribes to the provided channel pattern. Actual …\nSee redis PUBLISH command.\nUnsubscribes from the provided channel pattern.\nCloses the internal connection to redis. The client can …\nSee redis RENAME command.\nSee redis RENAMENX command.\nSee redis RPOP command.\nSee redis RPUSH command.\nSee redis RPUSHX command.\nInvokes the requested command with the provided arguments …\ninvokes the run_command but returns bool result\ninvokes the run_command but returns empty result\ninvokes the run_command and returns typed result\ninvokes the run_command but returns string result\nSee redis SADD command.\nSee redis SCARD command.\nSee redis SDIFF command.\nSee redis SET command.\nSee redis SETEX command.\nSee redis SETNX command.\nSee redis SISMEMBER command.\nSee redis SMEMBERS command.\nSee redis SMOVE command.\nSee redis SREM command.\nSee redis STRLEN command.\nSubscribes to the provided channel. Actual subscription …\nUnsubscribes from the provided channel.\nUnsubscribes from all channels.\nSee redis ZADD command.\nSee redis ZRANGE command.\nDescription text of the error reason\nContains the error value\nContains the error value\nContains the error value\nContains the error value\nEnable to modify blocking operations.\nPubSub message\nContains the success value\nContains the success value\nContains the success value\nContains the success value\nDefines a redis command argument\nHolds bool result or error\nHolds empty result or error\nHolds the error information\nRoot redis error\nRedis result which either holds a value or a Redis error\nHolds string result or error\nFormats the value using the given formatter.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nReturns a new instance.\nNext polling time in millies\nNotify blocking operation to stop") -------------------------------------------------------------------------------- /docs/api/static.files/src-script-813739b1.js: -------------------------------------------------------------------------------- 1 | "use strict";(function(){const rootPath=getVar("root-path");const NAME_OFFSET=0;const DIRS_OFFSET=1;const FILES_OFFSET=2;const RUSTDOC_MOBILE_BREAKPOINT=700;function closeSidebarIfMobile(){if(window.innerWidth{removeClass(document.documentElement,"src-sidebar-expanded");updateLocalStorage("source-sidebar-show","false");};window.rustdocShowSourceSidebar=()=>{addClass(document.documentElement,"src-sidebar-expanded");updateLocalStorage("source-sidebar-show","true");};window.rustdocToggleSrcSidebar=()=>{if(document.documentElement.classList.contains("src-sidebar-expanded")){window.rustdocCloseSourceSidebar();}else{window.rustdocShowSourceSidebar();}};function createSrcSidebar(srcIndexStr){const container=nonnull(document.querySelector("nav.sidebar"));const sidebar=document.createElement("div");sidebar.id="src-sidebar";const srcIndex=new Map(JSON.parse(srcIndexStr));let hasFoundFile=false;for(const[key,source]of srcIndex){source[NAME_OFFSET]=key;hasFoundFile=createDirEntry(source,sidebar,"",hasFoundFile);}container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus();}}function highlightSrcLines(){const match=window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);if(!match){return;}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10);}if(to{removeClass(e,"line-highlighted");});for(let i=from;i<=to;++i){elem=document.getElementById(""+i);if(!elem){break;}addClass(elem,"line-highlighted");}}const handleSrcHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,"","#"+name);highlightSrcLines();}else{location.replace("#"+name);}window.scrollTo(x,y);};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)||ev.ctrlKey||ev.altKey||ev.metaKey){return;}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp;}set_fragment(prev_line_id+"-"+cur_line_id);}else{prev_line_id=cur_line_id;set_fragment(""+cur_line_id);}};}());window.addEventListener("hashchange",highlightSrcLines);onEachLazy(document.querySelectorAll("a[data-nosnippet]"),el=>{el.addEventListener("click",handleSrcHighlight);});highlightSrcLines();window.createSrcSidebar=createSrcSidebar;})(); -------------------------------------------------------------------------------- /docs/api/simple_redis/all.html: -------------------------------------------------------------------------------- 1 | List of all items in this crate
-------------------------------------------------------------------------------- /examples/pubsub.rs: -------------------------------------------------------------------------------- 1 | use simple_redis; 2 | use simple_redis::{Interrupts, Message}; 3 | use std::{thread, time}; 4 | 5 | fn main() { 6 | match simple_redis::create("redis://127.0.0.1:6379/") { 7 | Ok(mut subscriber) => { 8 | println!("Created Redis Client"); 9 | 10 | // simple subscription to pub_sub_example channel 11 | subscriber.subscribe("pub_sub_example").unwrap(); 12 | 13 | // pattern based subscription 14 | subscriber.psubscribe("pub_sub_*").unwrap(); 15 | 16 | thread::spawn(|| { 17 | thread::sleep(time::Duration::from_secs(2)); 18 | 19 | match simple_redis::create("redis://127.0.0.1:6379/") { 20 | Ok(mut publisher) => { 21 | publisher 22 | .publish("pub_sub_example", "example message") 23 | .unwrap(); 24 | 25 | publisher.publish("pub_sub_test", "test message").unwrap(); 26 | } 27 | _ => panic!("test error"), 28 | }; 29 | }); 30 | 31 | // get next two messages, since we subscribed via pattern to same channel 32 | let mut counter: usize = 0; 33 | subscriber 34 | .fetch_messages( 35 | &mut |message: Message| -> bool { 36 | let payload: String = message.get_payload().unwrap(); 37 | println!("Read message: {}", payload); 38 | assert_eq!(payload, "example message"); 39 | 40 | counter = counter + 1; 41 | 42 | counter >= 2 43 | }, 44 | &mut || -> Interrupts { Interrupts::new() }, 45 | ) 46 | .unwrap(); 47 | 48 | // wait for another message which only comes on the pattern channel 49 | subscriber 50 | .fetch_messages( 51 | &mut |message: Message| -> bool { 52 | let payload: String = message.get_payload().unwrap(); 53 | println!("Read message: {}", payload); 54 | assert_eq!(payload, "test message"); 55 | 56 | true 57 | }, 58 | &mut || -> Interrupts { Interrupts::new() }, 59 | ) 60 | .unwrap(); 61 | 62 | subscriber.subscribe("pub_sub_second_run").unwrap(); 63 | subscriber.unsubscribe("pub_sub_example").unwrap(); 64 | subscriber.punsubscribe("pub_sub_*").unwrap(); 65 | 66 | thread::spawn(|| { 67 | thread::sleep(time::Duration::from_secs(2)); 68 | 69 | match simple_redis::create("redis://127.0.0.1:6379/") { 70 | Ok(mut publisher) => { 71 | publisher 72 | .publish("pub_sub_example", "example message") 73 | .unwrap(); 74 | 75 | publisher 76 | .publish("pub_sub_second_run", "second message") 77 | .unwrap(); 78 | } 79 | _ => panic!("test error"), 80 | }; 81 | }); 82 | 83 | subscriber 84 | .fetch_messages( 85 | &mut |message: Message| -> bool { 86 | let payload: String = message.get_payload().unwrap(); 87 | println!("Read message: {}", payload); 88 | assert_eq!(payload, "second message"); 89 | 90 | true 91 | }, 92 | &mut || -> Interrupts { Interrupts::new() }, 93 | ) 94 | .unwrap(); 95 | } 96 | Err(error) => println!("Unable to create Redis client: {}", error), 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /docs/api/simple_redis/client/index.html: -------------------------------------------------------------------------------- 1 | simple_redis::client - Rust

Module client

Source
Expand description

§client

2 |

Implements the redis client capabilities.

3 |

Structs§

Client
The redis client which enables to invoke redis operations.

Functions§

create
Constructs a new redis client.
4 | The redis connection string must be in the following format: redis://[:<passwd>@]<hostname>[:port][/<db>]
-------------------------------------------------------------------------------- /docs/api/static.files/favicon-044be391.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/api/simple_redis/type.RedisError.html: -------------------------------------------------------------------------------- 1 | RedisError in simple_redis - Rust

Type Alias RedisError

Source
pub type RedisError = RedisError;
Expand description

Error Type

2 |

Aliased Type§

pub enum RedisError {
3 |     RedisError(RedisError),
4 |     Description(&'static str),
5 | }

Variants§

§

RedisError(RedisError)

Root redis error

6 |
§

Description(&'static str)

Description text of the error reason

7 |
-------------------------------------------------------------------------------- /docs/api/simple_redis/type.RedisResult.html: -------------------------------------------------------------------------------- 1 | RedisResult in simple_redis - Rust

Type Alias RedisResult

Source
pub type RedisResult<T> = RedisResult<T>;
Expand description

Redis result which either holds a value or a Redis error

2 |

Aliased Type§

pub enum RedisResult<T> {
3 |     Ok(T),
4 |     Err(RedisError),
5 | }

Variants§

§1.0.0

Ok(T)

Contains the success value

6 |
§1.0.0

Err(RedisError)

Contains the error value

7 |
-------------------------------------------------------------------------------- /docs/api/simple_redis/types/type.RedisBoolResult.html: -------------------------------------------------------------------------------- 1 | RedisBoolResult in simple_redis::types - Rust

Type Alias RedisBoolResult

Source
pub type RedisBoolResult = RedisResult<bool>;
Expand description

Holds bool result or error

2 |

Aliased Type§

pub enum RedisBoolResult {
3 |     Ok(bool),
4 |     Err(RedisError),
5 | }

Variants§

§1.0.0

Ok(bool)

Contains the success value

6 |
§1.0.0

Err(RedisError)

Contains the error value

7 |
-------------------------------------------------------------------------------- /docs/api/static.files/FiraSans-LICENSE-05ab6dbd.txt: -------------------------------------------------------------------------------- 1 | // REUSE-IgnoreStart 2 | 3 | Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. 4 | with Reserved Font Name < Fira >, 5 | 6 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 7 | This license is copied below, and is also available with a FAQ at: 8 | http://scripts.sil.org/OFL 9 | 10 | 11 | ----------------------------------------------------------- 12 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 13 | ----------------------------------------------------------- 14 | 15 | PREAMBLE 16 | The goals of the Open Font License (OFL) are to stimulate worldwide 17 | development of collaborative font projects, to support the font creation 18 | efforts of academic and linguistic communities, and to provide a free and 19 | open framework in which fonts may be shared and improved in partnership 20 | with others. 21 | 22 | The OFL allows the licensed fonts to be used, studied, modified and 23 | redistributed freely as long as they are not sold by themselves. The 24 | fonts, including any derivative works, can be bundled, embedded, 25 | redistributed and/or sold with any software provided that any reserved 26 | names are not used by derivative works. The fonts and derivatives, 27 | however, cannot be released under any other type of license. The 28 | requirement for fonts to remain under this license does not apply 29 | to any document created using the fonts or their derivatives. 30 | 31 | DEFINITIONS 32 | "Font Software" refers to the set of files released by the Copyright 33 | Holder(s) under this license and clearly marked as such. This may 34 | include source files, build scripts and documentation. 35 | 36 | "Reserved Font Name" refers to any names specified as such after the 37 | copyright statement(s). 38 | 39 | "Original Version" refers to the collection of Font Software components as 40 | distributed by the Copyright Holder(s). 41 | 42 | "Modified Version" refers to any derivative made by adding to, deleting, 43 | or substituting -- in part or in whole -- any of the components of the 44 | Original Version, by changing formats or by porting the Font Software to a 45 | new environment. 46 | 47 | "Author" refers to any designer, engineer, programmer, technical 48 | writer or other person who contributed to the Font Software. 49 | 50 | PERMISSION & CONDITIONS 51 | Permission is hereby granted, free of charge, to any person obtaining 52 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 53 | redistribute, and sell modified and unmodified copies of the Font 54 | Software, subject to the following conditions: 55 | 56 | 1) Neither the Font Software nor any of its individual components, 57 | in Original or Modified Versions, may be sold by itself. 58 | 59 | 2) Original or Modified Versions of the Font Software may be bundled, 60 | redistributed and/or sold with any software, provided that each copy 61 | contains the above copyright notice and this license. These can be 62 | included either as stand-alone text files, human-readable headers or 63 | in the appropriate machine-readable metadata fields within text or 64 | binary files as long as those fields can be easily viewed by the user. 65 | 66 | 3) No Modified Version of the Font Software may use the Reserved Font 67 | Name(s) unless explicit written permission is granted by the corresponding 68 | Copyright Holder. This restriction only applies to the primary font name as 69 | presented to the users. 70 | 71 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 72 | Software shall not be used to promote, endorse or advertise any 73 | Modified Version, except to acknowledge the contribution(s) of the 74 | Copyright Holder(s) and the Author(s) or with their explicit written 75 | permission. 76 | 77 | 5) The Font Software, modified or unmodified, in part or in whole, 78 | must be distributed entirely under this license, and must not be 79 | distributed under any other license. The requirement for fonts to 80 | remain under this license does not apply to any document created 81 | using the Font Software. 82 | 83 | TERMINATION 84 | This license becomes null and void if any of the above conditions are 85 | not met. 86 | 87 | DISCLAIMER 88 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 89 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 90 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 91 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 92 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 93 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 94 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 95 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 96 | OTHER DEALINGS IN THE FONT SOFTWARE. 97 | 98 | // REUSE-IgnoreEnd 99 | -------------------------------------------------------------------------------- /docs/api/simple_redis/types/type.RedisEmptyResult.html: -------------------------------------------------------------------------------- 1 | RedisEmptyResult in simple_redis::types - Rust

Type Alias RedisEmptyResult

Source
pub type RedisEmptyResult = RedisResult<()>;
Expand description

Holds empty result or error

2 |

Aliased Type§

pub enum RedisEmptyResult {
3 |     Ok(()),
4 |     Err(RedisError),
5 | }

Variants§

§1.0.0

Ok(())

Contains the success value

6 |
§1.0.0

Err(RedisError)

Contains the error value

7 |
-------------------------------------------------------------------------------- /docs/api/simple_redis/types/type.RedisResult.html: -------------------------------------------------------------------------------- 1 | RedisResult in simple_redis::types - Rust

Type Alias RedisResult

Source
pub type RedisResult<T> = Result<T, RedisError>;
Expand description

Redis result which either holds a value or a Redis error

2 |

Aliased Type§

pub enum RedisResult<T> {
3 |     Ok(T),
4 |     Err(RedisError),
5 | }

Variants§

§1.0.0

Ok(T)

Contains the success value

6 |
§1.0.0

Err(RedisError)

Contains the error value

7 |
-------------------------------------------------------------------------------- /docs/api/simple_redis/fn.create.html: -------------------------------------------------------------------------------- 1 | create in simple_redis - Rust

Function create

Source
pub fn create(connection_string: &str) -> Result<Client, RedisError>
Expand description

Constructs a new redis client.
2 | The redis connection string must be in the following format: redis://[:<passwd>@]<hostname>[:port][/<db>]

3 |

§Arguments

4 |
    5 |
  • connection_string - The connection string in the format of: redis://[:<passwd>@]<hostname>[:port][/<db>]
  • 6 |
7 |

§Example

8 |
extern crate simple_redis;
 9 | 
10 | fn main() {
11 |     match simple_redis::create("redis://127.0.0.1:6379/") {
12 |         Ok(client) => println!("Created Redis Client"),
13 |         Err(error) => println!("Unable to create Redis client: {}", error)
14 |     }
15 | }
16 |
-------------------------------------------------------------------------------- /docs/api/static.files/SourceCodePro-LICENSE-67f54ca7.txt: -------------------------------------------------------------------------------- 1 | // REUSE-IgnoreStart 2 | 3 | Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. 4 | 5 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 6 | 7 | This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL 8 | 9 | 10 | ----------------------------------------------------------- 11 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 12 | ----------------------------------------------------------- 13 | 14 | PREAMBLE 15 | The goals of the Open Font License (OFL) are to stimulate worldwide 16 | development of collaborative font projects, to support the font creation 17 | efforts of academic and linguistic communities, and to provide a free and 18 | open framework in which fonts may be shared and improved in partnership 19 | with others. 20 | 21 | The OFL allows the licensed fonts to be used, studied, modified and 22 | redistributed freely as long as they are not sold by themselves. The 23 | fonts, including any derivative works, can be bundled, embedded, 24 | redistributed and/or sold with any software provided that any reserved 25 | names are not used by derivative works. The fonts and derivatives, 26 | however, cannot be released under any other type of license. The 27 | requirement for fonts to remain under this license does not apply 28 | to any document created using the fonts or their derivatives. 29 | 30 | DEFINITIONS 31 | "Font Software" refers to the set of files released by the Copyright 32 | Holder(s) under this license and clearly marked as such. This may 33 | include source files, build scripts and documentation. 34 | 35 | "Reserved Font Name" refers to any names specified as such after the 36 | copyright statement(s). 37 | 38 | "Original Version" refers to the collection of Font Software components as 39 | distributed by the Copyright Holder(s). 40 | 41 | "Modified Version" refers to any derivative made by adding to, deleting, 42 | or substituting -- in part or in whole -- any of the components of the 43 | Original Version, by changing formats or by porting the Font Software to a 44 | new environment. 45 | 46 | "Author" refers to any designer, engineer, programmer, technical 47 | writer or other person who contributed to the Font Software. 48 | 49 | PERMISSION & CONDITIONS 50 | Permission is hereby granted, free of charge, to any person obtaining 51 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 52 | redistribute, and sell modified and unmodified copies of the Font 53 | Software, subject to the following conditions: 54 | 55 | 1) Neither the Font Software nor any of its individual components, 56 | in Original or Modified Versions, may be sold by itself. 57 | 58 | 2) Original or Modified Versions of the Font Software may be bundled, 59 | redistributed and/or sold with any software, provided that each copy 60 | contains the above copyright notice and this license. These can be 61 | included either as stand-alone text files, human-readable headers or 62 | in the appropriate machine-readable metadata fields within text or 63 | binary files as long as those fields can be easily viewed by the user. 64 | 65 | 3) No Modified Version of the Font Software may use the Reserved Font 66 | Name(s) unless explicit written permission is granted by the corresponding 67 | Copyright Holder. This restriction only applies to the primary font name as 68 | presented to the users. 69 | 70 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 71 | Software shall not be used to promote, endorse or advertise any 72 | Modified Version, except to acknowledge the contribution(s) of the 73 | Copyright Holder(s) and the Author(s) or with their explicit written 74 | permission. 75 | 76 | 5) The Font Software, modified or unmodified, in part or in whole, 77 | must be distributed entirely under this license, and must not be 78 | distributed under any other license. The requirement for fonts to 79 | remain under this license does not apply to any document created 80 | using the Font Software. 81 | 82 | TERMINATION 83 | This license becomes null and void if any of the above conditions are 84 | not met. 85 | 86 | DISCLAIMER 87 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 88 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 89 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 90 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 91 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 92 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 93 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 94 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 95 | OTHER DEALINGS IN THE FONT SOFTWARE. 96 | 97 | // REUSE-IgnoreEnd 98 | -------------------------------------------------------------------------------- /docs/api/simple_redis/type.Interrupts.html: -------------------------------------------------------------------------------- 1 | Interrupts in simple_redis - Rust

Type Alias Interrupts

Source
pub type Interrupts = Interrupts;
Expand description

Blocking operations interrupts

2 |

Aliased Type§

pub struct Interrupts {
3 |     pub stop: bool,
4 |     pub next_polling_time: Option<u64>,
5 | }

Fields§

§stop: bool

Notify blocking operation to stop

6 |
§next_polling_time: Option<u64>

Next polling time in millies

7 |
-------------------------------------------------------------------------------- /docs/api/simple_redis/types/type.RedisStringResult.html: -------------------------------------------------------------------------------- 1 | RedisStringResult in simple_redis::types - Rust

Type Alias RedisStringResult

Source
pub type RedisStringResult = RedisResult<String>;
Expand description

Holds string result or error

2 |

Aliased Type§

pub enum RedisStringResult {
3 |     Ok(String),
4 |     Err(RedisError),
5 | }

Variants§

§1.0.0

Ok(String)

Contains the success value

6 |
§1.0.0

Err(RedisError)

Contains the error value

7 |
-------------------------------------------------------------------------------- /docs/api/simple_redis/client/fn.create.html: -------------------------------------------------------------------------------- 1 | create in simple_redis::client - Rust

Function create

Source
pub fn create(connection_string: &str) -> Result<Client, RedisError>
Expand description

Constructs a new redis client.
2 | The redis connection string must be in the following format: redis://[:<passwd>@]<hostname>[:port][/<db>]

3 |

§Arguments

4 |
    5 |
  • connection_string - The connection string in the format of: redis://[:<passwd>@]<hostname>[:port][/<db>]
  • 6 |
7 |

§Example

8 |
extern crate simple_redis;
 9 | fn main() {
10 |     match simple_redis::create("redis://127.0.0.1:6379/") {
11 |         Ok(client) => println!("Created Redis Client"),
12 |         Err(error) => println!("Unable to create Redis client: {}", error)
13 |     }
14 | }
15 |
-------------------------------------------------------------------------------- /docs/api/search-index.js: -------------------------------------------------------------------------------- 1 | var searchIndex = new Map(JSON.parse('[["simple_redis",{"t":"PPIIPIPICHOOCFNNNNHNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNPPPPPFIPPPPKIIGPIINNNNNNNNNNNNNNNNONONNNNNNNN","n":["Description","Err","Interrupts","Message","Ok","RedisError","","RedisResult","client","create","next_polling_time","stop","types","Client","append","auth","borrow","borrow_mut","create","del","echo","exists","expire","fetch_messages","from","get","get_string","getset","getset_string","hdel","hexists","hget","hget_string","hgetall","hkeys","hset","hsetnx","hvals","incr","incrby","incrbyfloat","into","is_connection_open","is_psubscribed","is_subscribed","keys","lindex","lindex_string","llen","lpop","lpush","lpushx","lrange","lrem","lset","ltrim","persist","pexpire","psubscribe","publish","punsubscribe","quit","rename","renamenx","rpop","rpush","rpushx","run_command","run_command_bool_response","run_command_empty_response","run_command_from_string_response","run_command_string_response","sadd","scard","sdiff","set","setex","setnx","sismember","smembers","smove","srem","strlen","subscribe","try_from","try_into","type_id","unsubscribe","unsubscribe_all","zadd","zrange","Description","Err","","","","Interrupts","Message","Ok","","","","RedisArg","RedisBoolResult","RedisEmptyResult","RedisError","","RedisResult","RedisStringResult","borrow","","borrow_mut","","clone","clone_into","clone_to_uninit","default","fmt","","","from","","into","","new","next_polling_time","source","stop","to_owned","to_string","try_from","","try_into","","type_id",""],"q":[[0,"simple_redis"],[13,"simple_redis::client"],[91,"simple_redis::types"],[136,"core::result"],[137,"core::option"],[138,"core::ops::function"],[139,"core::str::traits"],[140,"alloc::string"],[141,"std::collections::hash::map"],[142,"alloc::vec"],[143,"redis::types"],[144,"core::any"],[145,"core::fmt"],[146,"core::error"]],"i":"hDf``0`1```l0``f000`000000000000000000000000000000000000000000000000000000000000000000000000AfB`AdAhAj``3210````4``4Ch5000005505050005005505050","f":"`````````{{{d{b}}}{{j{fh}}}}{ln}{lA`}``{{{d{Abf}}{d{b}}{d{b}}}Ad}{{{d{Abf}}{d{b}}}Ad}{d{{d{c}}}{}}{{{d{Ab}}}{{d{Abc}}}{}}{{{d{b}}}{{j{fAf}}}}3{{{d{Abf}}{d{b}}}Ah}{{{d{Abf}}{d{b}}}Aj}{{{d{Abf}}{d{b}}Al}Ad}{{{d{Abf}}{d{AbAn}}{d{AbAn}}}Ad}{cc{}}{{{d{Abf}}{d{b}}}{{B`{c}}}Bb}5{{{d{Abf}}{d{b}}c}{{B`{e}}}BdBb}{{{d{Abf}}{d{b}}c}AhBd}<{{{d{Abf}}{d{b}}{d{b}}}Aj}{{{d{Abf}}{d{b}}{d{b}}}{{B`{c}}}Bb}{{{d{Abf}}{d{b}}{d{b}}}Ah}{{{d{Abf}}{d{b}}}{{B`{{Bh{BfBf}}}}}}{{{d{Abf}}{d{b}}}{{B`{{Bj{Bf}}}}}}{{{d{Abf}}{d{b}}{d{b}}c}AdBd}01{{{d{Abf}}{d{b}}}{{B`{Bl}}}}{{{d{Abf}}{d{b}}c}{{B`{Bl}}}Bd}{{{d{Abf}}{d{b}}c}{{B`{Bn}}}Bd}{{}c{}}{{{d{Abf}}}A`}{{{d{Abf}}{d{b}}}A`}07{{{d{Abf}}{d{b}}C`}{{B`{c}}}Bb}{{{d{Abf}}{d{b}}C`}Ah}{{{d{Abf}}{d{b}}}{{B`{Cb}}}}{{{d{Abf}}{d{b}}}{{B`{c}}}Bb}{{{d{Abf}}{d{b}}c}AdBd}0{{{d{Abf}}{d{b}}C`C`}{{B`{{Bj{Bf}}}}}}{{{d{Abf}}{d{b}}C`c}AdBd}0{{{d{Abf}}{d{b}}C`C`}Ad}{{{d{Abf}}{d{b}}}Ad}{{{d{Abf}}{d{b}}Al}Ad}1{{{d{Abf}}{d{b}}{d{b}}}Ad}2{{{d{Abf}}}Ad}11877{{{d{Abf}}{d{b}}{Bj{{d{b}}}}}{{B`{c}}}Cd}{{{d{Abf}}{d{b}}{Bj{{d{b}}}}}Aj}{{{d{Abf}}{d{b}}{Bj{{d{b}}}}}Ad}{{{d{Abf}}{d{b}}{Bj{{d{b}}}}}{{B`{c}}}Bb}{{{d{Abf}}{d{b}}{Bj{{d{b}}}}}Ah}{{{d{Abf}}{d{b}}{d{b}}}{{B`{Cb}}}}?{{{d{Abf}}{Bj{{d{b}}}}}{{B`{{Bj{Bf}}}}}}>{{{d{Abf}}{d{b}}cAl}AdBd}?{{{d{Abf}}{d{b}}{d{b}}}Aj}{{{d{Abf}}{d{b}}}{{B`{{Bj{Bf}}}}}}{{{d{Abf}}{d{b}}{d{b}}{d{b}}}Ad}<{{{d{Abf}}{d{b}}}{{B`{Cb}}}}?{c{{j{e}}}{}{}}{{}{{j{c}}}{}}{dCf}{{{d{Abf}}{d{b}}}Ad}{{{d{Abf}}}Ad}{{{d{Abf}}{d{b}}C`{d{b}}}{{B`{Cb}}}}{{{d{Abf}}{d{b}}C`C`}{{B`{{Bj{Bf}}}}}}``````````````````{d{{d{c}}}{}}0{{{d{Ab}}}{{d{Abc}}}{}}0{{{d{Ch}}}Ch}{{d{d{Abc}}}Cj{}}{{dCl}Cj}{{}Ch}{{{d{Af}}{d{AbCn}}}D`}{{{d{Af}}{d{AbCn}}}{{j{CjDb}}}}{{{d{Ch}}{d{AbCn}}}D`}{cc{}}0{{}c{}}05{Chn}{{{d{Af}}}{{n{{d{Dd}}}}}}{ChA`}{dc{}}{dBf}{c{{j{e}}}{}{}}0{{}{{j{c}}}{}}0{dCf}0","D":"Nb","p":[[1,"str"],[1,"reference",null,null,1],[5,"Client",13],[8,"RedisError",0],[6,"Result",136,null,1],[8,"Interrupts",0],[6,"Option",137,null,1],[1,"bool"],[0,"mut"],[8,"RedisEmptyResult",91],[6,"RedisError",91],[8,"RedisStringResult",91],[8,"RedisBoolResult",91],[1,"usize"],[10,"FnMut",138],[8,"RedisResult",91],[10,"FromStr",139],[10,"RedisArg",91],[5,"String",140],[5,"HashMap",141],[5,"Vec",142],[1,"i64"],[1,"f64"],[1,"isize"],[1,"i32"],[10,"FromRedisValue",143],[5,"TypeId",144],[5,"Interrupts",91],[1,"unit"],[1,"u8"],[5,"Formatter",145],[8,"Result",145],[5,"Error",145],[10,"Error",146],[8,"RedisResult",0]],"r":[],"b":[[117,"impl-Debug-for-RedisError"],[118,"impl-Display-for-RedisError"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAABcABgARAAEAVQACAG4ACAB4AAAAfwAAAIEABwA=","P":[[16,"T"],[18,""],[24,"T"],[26,""],[27,"T,V"],[28,"T"],[29,""],[31,"T"],[32,""],[35,"T"],[37,""],[39,"T"],[41,"U"],[42,""],[46,"T"],[47,""],[49,"T"],[52,""],[53,"T"],[55,""],[64,"T"],[68,""],[70,"T"],[71,""],[75,"T"],[78,""],[84,"U,T"],[85,"U"],[86,""],[109,"T"],[113,""],[114,"T"],[115,""],[120,"T"],[122,"U"],[124,""],[128,"T"],[129,""],[130,"U,T"],[132,"U"],[134,""]]}]]')); 2 | if (typeof exports !== 'undefined') exports.searchIndex = searchIndex; 3 | else if (window.initSearch) window.initSearch(searchIndex); 4 | //{"start":39,"fragment_lengths":[4951]} -------------------------------------------------------------------------------- /docs/api/static.files/SourceSerif4-LICENSE-a2cfd9d5.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. 4 | Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. 5 | 6 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 7 | 8 | This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL 9 | 10 | 11 | ----------------------------------------------------------- 12 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 13 | ----------------------------------------------------------- 14 | 15 | PREAMBLE 16 | The goals of the Open Font License (OFL) are to stimulate worldwide 17 | development of collaborative font projects, to support the font creation 18 | efforts of academic and linguistic communities, and to provide a free and 19 | open framework in which fonts may be shared and improved in partnership 20 | with others. 21 | 22 | The OFL allows the licensed fonts to be used, studied, modified and 23 | redistributed freely as long as they are not sold by themselves. The 24 | fonts, including any derivative works, can be bundled, embedded, 25 | redistributed and/or sold with any software provided that any reserved 26 | names are not used by derivative works. The fonts and derivatives, 27 | however, cannot be released under any other type of license. The 28 | requirement for fonts to remain under this license does not apply 29 | to any document created using the fonts or their derivatives. 30 | 31 | DEFINITIONS 32 | "Font Software" refers to the set of files released by the Copyright 33 | Holder(s) under this license and clearly marked as such. This may 34 | include source files, build scripts and documentation. 35 | 36 | "Reserved Font Name" refers to any names specified as such after the 37 | copyright statement(s). 38 | 39 | "Original Version" refers to the collection of Font Software components as 40 | distributed by the Copyright Holder(s). 41 | 42 | "Modified Version" refers to any derivative made by adding to, deleting, 43 | or substituting -- in part or in whole -- any of the components of the 44 | Original Version, by changing formats or by porting the Font Software to a 45 | new environment. 46 | 47 | "Author" refers to any designer, engineer, programmer, technical 48 | writer or other person who contributed to the Font Software. 49 | 50 | PERMISSION & CONDITIONS 51 | Permission is hereby granted, free of charge, to any person obtaining 52 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 53 | redistribute, and sell modified and unmodified copies of the Font 54 | Software, subject to the following conditions: 55 | 56 | 1) Neither the Font Software nor any of its individual components, 57 | in Original or Modified Versions, may be sold by itself. 58 | 59 | 2) Original or Modified Versions of the Font Software may be bundled, 60 | redistributed and/or sold with any software, provided that each copy 61 | contains the above copyright notice and this license. These can be 62 | included either as stand-alone text files, human-readable headers or 63 | in the appropriate machine-readable metadata fields within text or 64 | binary files as long as those fields can be easily viewed by the user. 65 | 66 | 3) No Modified Version of the Font Software may use the Reserved Font 67 | Name(s) unless explicit written permission is granted by the corresponding 68 | Copyright Holder. This restriction only applies to the primary font name as 69 | presented to the users. 70 | 71 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 72 | Software shall not be used to promote, endorse or advertise any 73 | Modified Version, except to acknowledge the contribution(s) of the 74 | Copyright Holder(s) and the Author(s) or with their explicit written 75 | permission. 76 | 77 | 5) The Font Software, modified or unmodified, in part or in whole, 78 | must be distributed entirely under this license, and must not be 79 | distributed under any other license. The requirement for fonts to 80 | remain under this license does not apply to any document created 81 | using the Font Software. 82 | 83 | TERMINATION 84 | This license becomes null and void if any of the above conditions are 85 | not met. 86 | 87 | DISCLAIMER 88 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 89 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 90 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 91 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 92 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 93 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 94 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 95 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 96 | OTHER DEALINGS IN THE FONT SOFTWARE. 97 | 98 | 99 | -------------------------------------------------------------------------------- /docs/api/simple_redis/types/index.html: -------------------------------------------------------------------------------- 1 | simple_redis::types - Rust

Module types

Source
Expand description

§types

2 |

Defines the various types and aliases used or exposed by the simple_redis library.

3 |

Structs§

Interrupts
Enable to modify blocking operations.

Enums§

RedisError
Holds the error information

Traits§

RedisArg
Defines a redis command argument

Type Aliases§

Message
PubSub message
RedisBoolResult
Holds bool result or error
RedisEmptyResult
Holds empty result or error
RedisResult
Redis result which either holds a value or a Redis error
RedisStringResult
Holds string result or error
-------------------------------------------------------------------------------- /docs/api/static.files/NanumBarunGothic-LICENSE-a37d393b.txt: -------------------------------------------------------------------------------- 1 | // REUSE-IgnoreStart 2 | 3 | Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/), 4 | 5 | with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, 6 | NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, 7 | Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco, 8 | NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic, 9 | Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen, MaruBuri 10 | 11 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 12 | This license is copied below, and is also available with a FAQ at: 13 | http://scripts.sil.org/OFL 14 | 15 | 16 | ----------------------------------------------------------- 17 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 18 | ----------------------------------------------------------- 19 | 20 | PREAMBLE 21 | The goals of the Open Font License (OFL) are to stimulate worldwide 22 | development of collaborative font projects, to support the font creation 23 | efforts of academic and linguistic communities, and to provide a free and 24 | open framework in which fonts may be shared and improved in partnership 25 | with others. 26 | 27 | The OFL allows the licensed fonts to be used, studied, modified and 28 | redistributed freely as long as they are not sold by themselves. The 29 | fonts, including any derivative works, can be bundled, embedded, 30 | redistributed and/or sold with any software provided that any reserved 31 | names are not used by derivative works. The fonts and derivatives, 32 | however, cannot be released under any other type of license. The 33 | requirement for fonts to remain under this license does not apply 34 | to any document created using the fonts or their derivatives. 35 | 36 | DEFINITIONS 37 | "Font Software" refers to the set of files released by the Copyright 38 | Holder(s) under this license and clearly marked as such. This may 39 | include source files, build scripts and documentation. 40 | 41 | "Reserved Font Name" refers to any names specified as such after the 42 | copyright statement(s). 43 | 44 | "Original Version" refers to the collection of Font Software components as 45 | distributed by the Copyright Holder(s). 46 | 47 | "Modified Version" refers to any derivative made by adding to, deleting, 48 | or substituting -- in part or in whole -- any of the components of the 49 | Original Version, by changing formats or by porting the Font Software to a 50 | new environment. 51 | 52 | "Author" refers to any designer, engineer, programmer, technical 53 | writer or other person who contributed to the Font Software. 54 | 55 | PERMISSION & CONDITIONS 56 | Permission is hereby granted, free of charge, to any person obtaining 57 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 58 | redistribute, and sell modified and unmodified copies of the Font 59 | Software, subject to the following conditions: 60 | 61 | 1) Neither the Font Software nor any of its individual components, 62 | in Original or Modified Versions, may be sold by itself. 63 | 64 | 2) Original or Modified Versions of the Font Software may be bundled, 65 | redistributed and/or sold with any software, provided that each copy 66 | contains the above copyright notice and this license. These can be 67 | included either as stand-alone text files, human-readable headers or 68 | in the appropriate machine-readable metadata fields within text or 69 | binary files as long as those fields can be easily viewed by the user. 70 | 71 | 3) No Modified Version of the Font Software may use the Reserved Font 72 | Name(s) unless explicit written permission is granted by the corresponding 73 | Copyright Holder. This restriction only applies to the primary font name as 74 | presented to the users. 75 | 76 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 77 | Software shall not be used to promote, endorse or advertise any 78 | Modified Version, except to acknowledge the contribution(s) of the 79 | Copyright Holder(s) and the Author(s) or with their explicit written 80 | permission. 81 | 82 | 5) The Font Software, modified or unmodified, in part or in whole, 83 | must be distributed entirely under this license, and must not be 84 | distributed under any other license. The requirement for fonts to 85 | remain under this license does not apply to any document created 86 | using the Font Software. 87 | 88 | TERMINATION 89 | This license becomes null and void if any of the above conditions are 90 | not met. 91 | 92 | DISCLAIMER 93 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 94 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 95 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 96 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 97 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 98 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 99 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 100 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 101 | OTHER DEALINGS IN THE FONT SOFTWARE. 102 | 103 | // REUSE-IgnoreEnd 104 | -------------------------------------------------------------------------------- /tests/client_test.rs: -------------------------------------------------------------------------------- 1 | use simple_redis; 2 | use simple_redis::{Interrupts, Message}; 3 | use std::{thread, time}; 4 | 5 | #[test] 6 | fn create_invalid_url() { 7 | let result = simple_redis::create("test/bad/url"); 8 | assert!(result.is_err()); 9 | } 10 | 11 | #[test] 12 | fn create_valid_url() { 13 | let result = simple_redis::create("redis://127.0.0.1:6379/"); 14 | assert!(result.is_ok()); 15 | 16 | match result { 17 | Ok(mut client) => assert!(!client.is_connection_open()), 18 | _ => panic!("test error"), 19 | }; 20 | } 21 | 22 | #[test] 23 | fn run_command() { 24 | let mut client = simple_redis::create("redis://127.0.0.1:6379/").unwrap(); 25 | 26 | assert!(!client.is_connection_open()); 27 | 28 | match client.run_command::("ECHO", vec!["testing"]) { 29 | Ok(value) => assert_eq!(value, "testing"), 30 | _ => panic!("test error"), 31 | } 32 | 33 | assert!(client.is_connection_open()); 34 | } 35 | 36 | #[test] 37 | fn run_command_invalid() { 38 | let mut client = simple_redis::create("redis://127.0.0.1:6379/").unwrap(); 39 | 40 | let result = client.run_command::("BADCOMMAND", vec!["testing"]); 41 | 42 | assert!(result.is_err()); 43 | } 44 | 45 | #[test] 46 | fn run_command_typed_response() { 47 | let mut client = simple_redis::create("redis://127.0.0.1:6379/").unwrap(); 48 | 49 | assert!(!client.is_connection_open()); 50 | 51 | let empty_result = client.run_command_empty_response("SET", vec!["int_test_1", "my_value"]); 52 | assert!(empty_result.is_ok()); 53 | 54 | assert!(client.is_connection_open()); 55 | 56 | let string_result = client 57 | .run_command_string_response("GET", vec!["int_test_1"]) 58 | .unwrap(); 59 | assert_eq!(string_result, "my_value"); 60 | 61 | let error_result = client.run_command_string_response("BADCOMMAND", vec!["int_test_1"]); 62 | assert!(error_result.is_err()); 63 | } 64 | 65 | #[test] 66 | fn quit_no_connection() { 67 | let mut client = simple_redis::create("redis://127.0.0.1:6379/").unwrap(); 68 | 69 | assert!(!client.is_connection_open()); 70 | 71 | client.quit().unwrap(); 72 | 73 | assert!(!client.is_connection_open()); 74 | 75 | match client.echo("testing") { 76 | Ok(value) => assert_eq!(value, "testing"), 77 | _ => panic!("test error"), 78 | } 79 | 80 | assert!(client.is_connection_open()); 81 | } 82 | 83 | #[test] 84 | fn quit_no_subscriptions() { 85 | let mut client = simple_redis::create("redis://127.0.0.1:6379/").unwrap(); 86 | 87 | assert!(!client.is_connection_open()); 88 | 89 | match client.echo("testing") { 90 | Ok(value) => assert_eq!(value, "testing"), 91 | _ => panic!("test error"), 92 | } 93 | 94 | assert!(client.is_connection_open()); 95 | 96 | client.quit().unwrap(); 97 | 98 | assert!(!client.is_connection_open()); 99 | 100 | match client.echo("testing") { 101 | Ok(value) => assert_eq!(value, "testing"), 102 | _ => panic!("test error"), 103 | } 104 | 105 | assert!(client.is_connection_open()); 106 | } 107 | 108 | #[test] 109 | fn quit_internal_subscriptions() { 110 | let mut client = simple_redis::create("redis://127.0.0.1:6379/").unwrap(); 111 | 112 | assert!(!client.is_connection_open()); 113 | 114 | match client.echo("testing") { 115 | Ok(value) => assert_eq!(value, "testing"), 116 | _ => panic!("test error"), 117 | } 118 | 119 | assert!(client.is_connection_open()); 120 | 121 | assert!(!client.is_subscribed("quit_internal_subscriptions")); 122 | assert!(!client.is_psubscribed("quit_internal_*")); 123 | 124 | client.subscribe("quit_internal_subscriptions").unwrap(); 125 | client.psubscribe("quit_internal_*").unwrap(); 126 | 127 | assert!(client.is_subscribed("quit_internal_subscriptions")); 128 | assert!(client.is_psubscribed("quit_internal_*")); 129 | 130 | client.quit().unwrap(); 131 | assert!(!client.is_connection_open()); 132 | 133 | assert!(!client.is_subscribed("quit_internal_subscriptions")); 134 | assert!(!client.is_psubscribed("quit_internal_*")); 135 | 136 | match client.echo("testing") { 137 | Ok(value) => assert_eq!(value, "testing"), 138 | _ => panic!("test error"), 139 | } 140 | 141 | assert!(client.is_connection_open()); 142 | } 143 | 144 | #[test] 145 | fn quit_live_subscriptions() { 146 | let mut client = simple_redis::create("redis://127.0.0.1:6379/").unwrap(); 147 | 148 | assert!(!client.is_connection_open()); 149 | 150 | match client.echo("testing") { 151 | Ok(value) => assert_eq!(value, "testing"), 152 | _ => panic!("test error"), 153 | } 154 | 155 | assert!(client.is_connection_open()); 156 | 157 | assert!(!client.is_subscribed("quit_live_subscriptions")); 158 | assert!(!client.is_psubscribed("quit_live_*")); 159 | 160 | client.subscribe("quit_live_subscriptions").unwrap(); 161 | client.psubscribe("quit_live_*").unwrap(); 162 | 163 | assert!(client.is_subscribed("quit_live_subscriptions")); 164 | assert!(client.is_psubscribed("quit_live_*")); 165 | 166 | thread::spawn(|| { 167 | thread::sleep(time::Duration::from_secs(2)); 168 | let mut publisher = simple_redis::create("redis://127.0.0.1:6379/").unwrap(); 169 | publisher 170 | .publish("quit_live_subscriptions_TEST", "test pub_sub message") 171 | .unwrap(); 172 | }); 173 | 174 | client 175 | .fetch_messages( 176 | &mut |message: Message| -> bool { 177 | let payload: String = message.get_payload().unwrap(); 178 | assert_eq!(payload, "test pub_sub message"); 179 | true 180 | }, 181 | &mut || -> Interrupts { Interrupts::new() }, 182 | ) 183 | .unwrap(); 184 | 185 | client.quit().unwrap(); 186 | assert!(!client.is_connection_open()); 187 | 188 | assert!(!client.is_subscribed("quit_live_subscriptions")); 189 | assert!(!client.is_psubscribed("quit_live_*")); 190 | 191 | match client.echo("testing") { 192 | Ok(value) => assert_eq!(value, "testing"), 193 | _ => panic!("test error"), 194 | } 195 | 196 | assert!(client.is_connection_open()); 197 | } 198 | -------------------------------------------------------------------------------- /docs/api/static.files/storage-68b7e25d.js: -------------------------------------------------------------------------------- 1 | "use strict";const builtinThemes=["light","dark","ayu"];const darkThemes=["dark","ayu"];window.currentTheme=(function(){const currentTheme=document.getElementById("themeStyle");return currentTheme instanceof HTMLLinkElement?currentTheme:null;})();const settingsDataset=(function(){const settingsElement=document.getElementById("default-settings");return settingsElement&&settingsElement.dataset?settingsElement.dataset:null;})();function nonnull(x,msg){if(x===null){throw(msg||"unexpected null value!");}else{return x;}}function nonundef(x,msg){if(x===undefined){throw(msg||"unexpected null value!");}else{return x;}}function getSettingValue(settingName){const current=getCurrentValue(settingName);if(current===null&&settingsDataset!==null){const def=settingsDataset[settingName.replace(/-/g,"_")];if(def!==undefined){return def;}}return current;}const localStoredTheme=getSettingValue("theme");function hasClass(elem,className){return!!elem&&!!elem.classList&&elem.classList.contains(className);}function addClass(elem,className){if(elem&&elem.classList){elem.classList.add(className);}}function removeClass(elem,className){if(elem&&elem.classList){elem.classList.remove(className);}}function onEach(arr,func){for(const elem of arr){if(func(elem)){return true;}}return false;}function onEachLazy(lazyArray,func){return onEach(Array.prototype.slice.call(lazyArray),func);}function updateLocalStorage(name,value){try{if(value===null){window.localStorage.removeItem("rustdoc-"+name);}else{window.localStorage.setItem("rustdoc-"+name,value);}}catch(e){}}function getCurrentValue(name){try{return window.localStorage.getItem("rustdoc-"+name);}catch(e){return null;}}function getVar(name){const el=document.querySelector("head > meta[name='rustdoc-vars']");return el?el.getAttribute("data-"+name):null;}function switchTheme(newThemeName,saveTheme){const themeNames=(getVar("themes")||"").split(",").filter(t=>t);themeNames.push(...builtinThemes);if(newThemeName===null||themeNames.indexOf(newThemeName)===-1){return;}if(saveTheme){updateLocalStorage("theme",newThemeName);}document.documentElement.setAttribute("data-theme",newThemeName);if(builtinThemes.indexOf(newThemeName)!==-1){if(window.currentTheme&&window.currentTheme.parentNode){window.currentTheme.parentNode.removeChild(window.currentTheme);window.currentTheme=null;}}else{const newHref=getVar("root-path")+encodeURIComponent(newThemeName)+getVar("resource-suffix")+".css";if(!window.currentTheme){if(document.readyState==="loading"){document.write(``);window.currentTheme=(function(){const currentTheme=document.getElementById("themeStyle");return currentTheme instanceof HTMLLinkElement?currentTheme:null;})();}else{window.currentTheme=document.createElement("link");window.currentTheme.rel="stylesheet";window.currentTheme.id="themeStyle";window.currentTheme.href=newHref;document.documentElement.appendChild(window.currentTheme);}}else if(newHref!==window.currentTheme.href){window.currentTheme.href=newHref;}}}const updateTheme=(function(){const mql=window.matchMedia("(prefers-color-scheme: dark)");function updateTheme(){if(getSettingValue("use-system-theme")!=="false"){const lightTheme=getSettingValue("preferred-light-theme")||"light";const darkTheme=getSettingValue("preferred-dark-theme")||"dark";updateLocalStorage("use-system-theme","true");switchTheme(mql.matches?darkTheme:lightTheme,true);}else{switchTheme(getSettingValue("theme"),false);}}mql.addEventListener("change",updateTheme);return updateTheme;})();if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&localStoredTheme!==null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("preferred-dark-theme",localStoredTheme);}}updateTheme();if(getSettingValue("source-sidebar-show")==="true"){addClass(document.documentElement,"src-sidebar-expanded");}if(getSettingValue("hide-sidebar")==="true"){addClass(document.documentElement,"hide-sidebar");}if(getSettingValue("hide-toc")==="true"){addClass(document.documentElement,"hide-toc");}if(getSettingValue("hide-modnav")==="true"){addClass(document.documentElement,"hide-modnav");}if(getSettingValue("sans-serif-fonts")==="true"){addClass(document.documentElement,"sans-serif");}if(getSettingValue("word-wrap-source-code")==="true"){addClass(document.documentElement,"word-wrap-source-code");}function updateSidebarWidth(){const desktopSidebarWidth=getSettingValue("desktop-sidebar-width");if(desktopSidebarWidth&&desktopSidebarWidth!=="null"){document.documentElement.style.setProperty("--desktop-sidebar-width",desktopSidebarWidth+"px",);}const srcSidebarWidth=getSettingValue("src-sidebar-width");if(srcSidebarWidth&&srcSidebarWidth!=="null"){document.documentElement.style.setProperty("--src-sidebar-width",srcSidebarWidth+"px",);}}updateSidebarWidth();window.addEventListener("pageshow",ev=>{if(ev.persisted){setTimeout(updateTheme,0);setTimeout(updateSidebarWidth,0);}});class RustdocSearchElement extends HTMLElement{constructor(){super();}connectedCallback(){const rootPath=getVar("root-path");const currentCrate=getVar("current-crate");this.innerHTML=``;}}window.customElements.define("rustdoc-search",RustdocSearchElement);class RustdocToolbarElement extends HTMLElement{constructor(){super();}connectedCallback(){if(this.firstElementChild){return;}const rootPath=getVar("root-path");this.innerHTML=` 17 |
18 | Settings 19 |
20 |
21 | Help 22 |
23 | `;}}window.customElements.define("rustdoc-toolbar",RustdocToolbarElement); -------------------------------------------------------------------------------- /docs/api/type.impl/simple_redis/types/struct.Interrupts.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var type_impls = Object.fromEntries([["simple_redis",[["
Source§

impl Clone for Interrupts

Source§

fn clone(&self) -> Interrupts

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
","Clone","simple_redis::Interrupts"],["
Source§

impl Debug for Interrupts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
","Debug","simple_redis::Interrupts"],["
Source§

impl Default for Interrupts

Source§

fn default() -> Interrupts

Returns the “default value” for a type. Read more
","Default","simple_redis::Interrupts"],["
Source§

impl Interrupts

Source

pub fn new() -> Interrupts

Returns a new instance.

\n
",0,"simple_redis::Interrupts"],["
Source§

impl Copy for Interrupts

","Copy","simple_redis::Interrupts"]]]]); 3 | if (window.register_type_impls) { 4 | window.register_type_impls(type_impls); 5 | } else { 6 | window.pending_type_impls = type_impls; 7 | } 8 | })() 9 | //{"start":55,"fragment_lengths":[6787]} -------------------------------------------------------------------------------- /docs/api/static.files/settings-5514c975.js: -------------------------------------------------------------------------------- 1 | "use strict";(function(){const isSettingsPage=window.location.pathname.endsWith("/settings.html");function elemContainsTarget(elem,target){if(target instanceof Node){return elem.contains(target);}else{return false;}}function changeSetting(settingName,value){if(settingName==="theme"){const useSystem=value==="system preference"?"true":"false";updateLocalStorage("use-system-theme",useSystem);}updateLocalStorage(settingName,""+value);switch(settingName){case"theme":case"preferred-dark-theme":case"preferred-light-theme":updateTheme();updateLightAndDark();break;case"line-numbers":if(value===true){const f=window.rustdoc_add_line_numbers_to_examples;if(f!==undefined){f();}}else{const f=window.rustdoc_remove_line_numbers_from_examples;if(f!==undefined){f();}}break;case"hide-sidebar":if(value===true){addClass(document.documentElement,"hide-sidebar");}else{removeClass(document.documentElement,"hide-sidebar");}break;case"hide-toc":if(value===true){addClass(document.documentElement,"hide-toc");}else{removeClass(document.documentElement,"hide-toc");}break;case"hide-modnav":if(value===true){addClass(document.documentElement,"hide-modnav");}else{removeClass(document.documentElement,"hide-modnav");}break;case"sans-serif-fonts":if(value===true){addClass(document.documentElement,"sans-serif");}else{removeClass(document.documentElement,"sans-serif");}break;case"word-wrap-source-code":if(value===true){addClass(document.documentElement,"word-wrap-source-code");}else{removeClass(document.documentElement,"word-wrap-source-code");}break;}}function showLightAndDark(){removeClass(document.getElementById("preferred-light-theme"),"hidden");removeClass(document.getElementById("preferred-dark-theme"),"hidden");}function hideLightAndDark(){addClass(document.getElementById("preferred-light-theme"),"hidden");addClass(document.getElementById("preferred-dark-theme"),"hidden");}function updateLightAndDark(){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||(useSystem===null&&getSettingValue("theme")===null)){showLightAndDark();}else{hideLightAndDark();}}function setEvents(settingsElement){updateLightAndDark();onEachLazy(settingsElement.querySelectorAll("input[type=\"checkbox\"]"),toggle=>{const settingId=toggle.id;const settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true";}toggle.onchange=()=>{changeSetting(toggle.id,toggle.checked);};});onEachLazy(settingsElement.querySelectorAll("input[type=\"radio\"]"),elem=>{const settingId=elem.name;let settingValue=getSettingValue(settingId);if(settingId==="theme"){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||settingValue===null){settingValue=useSystem==="false"?"light":"system preference";}}if(settingValue!==null&&settingValue!=="null"){elem.checked=settingValue===elem.value;}elem.addEventListener("change",()=>{changeSetting(elem.name,elem.value);});},);}function buildSettingsPageSections(settings){let output="";for(const setting of settings){const js_data_name=setting["js_name"];const setting_name=setting["name"];if(setting["options"]!==undefined){output+=`\ 2 |
3 |
${setting_name}
4 |
`;onEach(setting["options"],option=>{const checked=option===setting["default"]?" checked":"";const full=`${js_data_name}-${option.replace(/ /g,"-")}`;output+=`\ 5 | `;});output+=`\ 10 |
11 |
`;}else{const checked=setting["default"]===true?" checked":"";output+=`\ 12 |
\ 13 | \ 17 |
`;}}return output;}function buildSettingsPage(){const theme_list=getVar("themes");const theme_names=(theme_list===null?"":theme_list).split(",").filter(t=>t);theme_names.push("light","dark","ayu");const settings=[{"name":"Theme","js_name":"theme","default":"system preference","options":theme_names.concat("system preference"),},{"name":"Preferred light theme","js_name":"preferred-light-theme","default":"light","options":theme_names,},{"name":"Preferred dark theme","js_name":"preferred-dark-theme","default":"dark","options":theme_names,},{"name":"Auto-hide item contents for large items","js_name":"auto-hide-large-items","default":true,},{"name":"Auto-hide item methods' documentation","js_name":"auto-hide-method-docs","default":false,},{"name":"Auto-hide trait implementation documentation","js_name":"auto-hide-trait-implementations","default":false,},{"name":"Directly go to item in search if there is only one result","js_name":"go-to-only-result","default":false,},{"name":"Show line numbers on code examples","js_name":"line-numbers","default":false,},{"name":"Hide persistent navigation bar","js_name":"hide-sidebar","default":false,},{"name":"Hide table of contents","js_name":"hide-toc","default":false,},{"name":"Hide module navigation","js_name":"hide-modnav","default":false,},{"name":"Disable keyboard shortcuts","js_name":"disable-shortcuts","default":false,},{"name":"Use sans serif fonts","js_name":"sans-serif-fonts","default":false,},{"name":"Word wrap source code","js_name":"word-wrap-source-code","default":false,},];const elementKind=isSettingsPage?"section":"div";const innerHTML=`
${buildSettingsPageSections(settings)}
`;const el=document.createElement(elementKind);el.id="settings";if(!isSettingsPage){el.className="popover";}el.innerHTML=innerHTML;if(isSettingsPage){const mainElem=document.getElementById(MAIN_ID);if(mainElem!==null){mainElem.appendChild(el);}}else{el.setAttribute("tabindex","-1");const settingsBtn=getSettingsButton();if(settingsBtn!==null){settingsBtn.appendChild(el);}}return el;}const settingsMenu=buildSettingsPage();function displaySettings(){settingsMenu.style.display="";onEachLazy(settingsMenu.querySelectorAll("input[type='checkbox']"),el=>{const val=getSettingValue(el.id);const checked=val==="true";if(checked!==el.checked&&val!==null){el.checked=checked;}});}function settingsBlurHandler(event){const helpBtn=getHelpButton();const settingsBtn=getSettingsButton();const helpUnfocused=helpBtn===null||(!helpBtn.contains(document.activeElement)&&!elemContainsTarget(helpBtn,event.relatedTarget));const settingsUnfocused=settingsBtn===null||(!settingsBtn.contains(document.activeElement)&&!elemContainsTarget(settingsBtn,event.relatedTarget));if(helpUnfocused&&settingsUnfocused){window.hidePopoverMenus();}}if(!isSettingsPage){const settingsButton=nonnull(getSettingsButton());const settingsMenu=nonnull(document.getElementById("settings"));settingsButton.onclick=event=>{if(elemContainsTarget(settingsMenu,event.target)){return;}event.preventDefault();const shouldDisplaySettings=settingsMenu.style.display==="none";window.hideAllModals(false);if(shouldDisplaySettings){displaySettings();}};settingsButton.onblur=settingsBlurHandler;nonnull(settingsButton.querySelector("a")).onblur=settingsBlurHandler;onEachLazy(settingsMenu.querySelectorAll("input"),el=>{el.onblur=settingsBlurHandler;});settingsMenu.onblur=settingsBlurHandler;}setTimeout(()=>{setEvents(settingsMenu);if(!isSettingsPage){displaySettings();}removeClass(getSettingsButton(),"rotate");},0);})(); -------------------------------------------------------------------------------- /src/subscriber.rs: -------------------------------------------------------------------------------- 1 | //! # commands 2 | //! 3 | //! Manages the pubsub subscriber connection and if needed resubscribes in case of reconnections. 4 | //! 5 | 6 | #[cfg(test)] 7 | #[path = "./subscriber_test.rs"] 8 | mod subscriber_test; 9 | 10 | use crate::types::{Interrupts, Message, RedisEmptyResult, RedisError}; 11 | use std::time::Duration; 12 | 13 | /// The redis pubsub wrapper. 14 | pub(crate) struct Subscriber { 15 | subscriptions: Vec, 16 | psubscriptions: Vec, 17 | redis_connection: Option, 18 | } 19 | 20 | fn subscribe_all<'a>( 21 | subscriber: &'a mut Subscriber, 22 | client: &redis::Client, 23 | ) -> Result, RedisError> { 24 | // get pubsub 25 | match client.get_connection() { 26 | Ok(redis_connection) => { 27 | let redis_connection_ref = subscriber.redis_connection.get_or_insert(redis_connection); 28 | let mut redis_pubsub = redis_connection_ref.as_pubsub(); 29 | 30 | for channel in &subscriber.subscriptions { 31 | let result = redis_pubsub.subscribe(channel); 32 | 33 | if result.is_err() { 34 | let subscription_error = match result.err() { 35 | Some(error) => Err(RedisError::RedisError(error)), 36 | None => Err(RedisError::Description("Error while subscribing.")), 37 | }; 38 | 39 | return subscription_error; 40 | } 41 | } 42 | 43 | for channel in &subscriber.psubscriptions { 44 | let result = redis_pubsub.psubscribe(channel); 45 | 46 | if result.is_err() { 47 | let subscription_error = match result.err() { 48 | Some(error) => Err(RedisError::RedisError(error)), 49 | None => Err(RedisError::Description("Error while subscribing.")), 50 | }; 51 | 52 | return subscription_error; 53 | } 54 | } 55 | 56 | Ok(redis_pubsub) 57 | } 58 | Err(error) => Err(RedisError::RedisError(error)), 59 | } 60 | } 61 | 62 | fn fetch_messages( 63 | mut redis_pubsub: redis::PubSub, 64 | on_message: &mut dyn FnMut(Message) -> bool, 65 | poll_interrupts: &mut dyn FnMut() -> Interrupts, 66 | ) -> RedisEmptyResult { 67 | loop { 68 | let interrupts = poll_interrupts(); 69 | if interrupts.stop { 70 | return Ok(()); 71 | } else { 72 | let duration_millis = interrupts.next_polling_time.unwrap_or(5000); 73 | 74 | let read_timeout = if duration_millis == 0 { 75 | None 76 | } else { 77 | Some(Duration::from_millis(duration_millis)) 78 | }; 79 | if let Err(error) = redis_pubsub.set_read_timeout(read_timeout) { 80 | return Err(RedisError::RedisError(error)); 81 | }; 82 | 83 | let message_result = redis_pubsub.get_message(); 84 | 85 | match message_result { 86 | Ok(message) => { 87 | if on_message(message) { 88 | return Ok(()); 89 | } 90 | } 91 | Err(error) => { 92 | if !error.is_timeout() { 93 | return Err(RedisError::RedisError(error)); 94 | } 95 | } 96 | } 97 | } 98 | } 99 | } 100 | 101 | fn subscribe_and_fetch( 102 | subscriber: &mut Subscriber, 103 | client: &redis::Client, 104 | on_message: &mut dyn FnMut(Message) -> bool, 105 | poll_interrupts: &mut dyn FnMut() -> Interrupts, 106 | ) -> RedisEmptyResult { 107 | match subscribe_all(subscriber, client) { 108 | Err(error) => Err(error), 109 | Ok(pubsub) => fetch_messages(pubsub, on_message, poll_interrupts), 110 | } 111 | } 112 | 113 | fn subscribe(subscriber: &mut Subscriber, channel: &str, pattern: bool) -> RedisEmptyResult { 114 | if pattern { 115 | subscriber.psubscriptions.push(channel.to_string()); 116 | } else { 117 | subscriber.subscriptions.push(channel.to_string()); 118 | } 119 | 120 | Ok(()) 121 | } 122 | 123 | fn unsubscribe(subscriber: &mut Subscriber, channel: &str, pattern: bool) -> RedisEmptyResult { 124 | let search_result = if pattern { 125 | subscriber.psubscriptions.iter().position(|x| x == channel) 126 | } else { 127 | subscriber.subscriptions.iter().position(|x| x == channel) 128 | }; 129 | 130 | match search_result { 131 | Some(index) => { 132 | if pattern { 133 | subscriber.psubscriptions.remove(index); 134 | } else { 135 | subscriber.subscriptions.remove(index); 136 | } 137 | 138 | Ok(()) 139 | } 140 | None => Ok(()), 141 | } 142 | } 143 | 144 | impl Subscriber { 145 | pub(crate) fn subscribe(self: &mut Subscriber, channel: &str) -> RedisEmptyResult { 146 | subscribe(self, channel, false) 147 | } 148 | 149 | pub(crate) fn psubscribe(self: &mut Subscriber, channel: &str) -> RedisEmptyResult { 150 | subscribe(self, channel, true) 151 | } 152 | 153 | pub(crate) fn unsubscribe(self: &mut Subscriber, channel: &str) -> RedisEmptyResult { 154 | unsubscribe(self, channel, false) 155 | } 156 | 157 | pub(crate) fn punsubscribe(self: &mut Subscriber, channel: &str) -> RedisEmptyResult { 158 | unsubscribe(self, channel, true) 159 | } 160 | 161 | pub(crate) fn is_subscribed(self: &mut Subscriber, channel: &str) -> bool { 162 | let search_result = self.subscriptions.iter().position(|x| x == channel); 163 | 164 | match search_result { 165 | None => false, 166 | _ => true, 167 | } 168 | } 169 | 170 | pub(crate) fn is_psubscribed(self: &mut Subscriber, channel: &str) -> bool { 171 | let search_result = self.psubscriptions.iter().position(|x| x == channel); 172 | 173 | match search_result { 174 | None => false, 175 | _ => true, 176 | } 177 | } 178 | 179 | pub(crate) fn unsubscribe_all(self: &mut Subscriber) -> RedisEmptyResult { 180 | self.subscriptions.clear(); 181 | self.psubscriptions.clear(); 182 | 183 | Ok(()) 184 | } 185 | 186 | fn has_subscriptions(self: &Subscriber) -> bool { 187 | !self.subscriptions.is_empty() || !self.psubscriptions.is_empty() 188 | } 189 | 190 | pub(crate) fn fetch_messages( 191 | self: &mut Subscriber, 192 | client: &redis::Client, 193 | on_message: &mut dyn FnMut(Message) -> bool, 194 | poll_interrupts: &mut dyn FnMut() -> Interrupts, 195 | ) -> RedisEmptyResult { 196 | if !self.has_subscriptions() { 197 | Err(RedisError::Description("No subscriptions defined.")) 198 | } else { 199 | subscribe_and_fetch(self, client, on_message, poll_interrupts) 200 | } 201 | } 202 | } 203 | 204 | /// Creates and returns a new connection 205 | pub(crate) fn create() -> Subscriber { 206 | Subscriber { 207 | subscriptions: vec![], 208 | psubscriptions: vec![], 209 | redis_connection: None, 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /docs/api/static.files/noscript-32bb7600.css: -------------------------------------------------------------------------------- 1 | #main-content .attributes{margin-left:0 !important;}#copy-path,#sidebar-button,.sidebar-resizer{display:none !important;}nav.sub{display:none;}.src .sidebar{display:none;}.notable-traits{display:none;}:root,:root:not([data-theme]){--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--sidebar-border-color:#ddd;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--mobile-sidebar-menu-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--code-example-button-color:#7f7f7f;--code-example-button-hover-color:#595959;--settings-menu-filter:invert(50%);--settings-menu-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);--sidebar-resizer-hover:hsl(207,90%,66%);--sidebar-resizer-active:hsl(207,90%,54%);}@media (prefers-color-scheme:dark){:root,:root:not([data-theme]){--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--sidebar-border-color:#2A2A2A;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--mobile-sidebar-menu-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--code-example-button-color:#7f7f7f;--code-example-button-hover-color:#a5a5a5;--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--settings-menu-filter:invert(50%);--settings-menu-hover-filter:invert(65%);--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);--sidebar-resizer-hover:hsl(207,30%,54%);--sidebar-resizer-active:hsl(207,90%,54%);}} -------------------------------------------------------------------------------- /tests/pubsub_test.rs: -------------------------------------------------------------------------------- 1 | use simple_redis; 2 | use simple_redis::{Interrupts, Message}; 3 | use std::{thread, time}; 4 | 5 | #[test] 6 | fn pub_sub() { 7 | match simple_redis::create("redis://127.0.0.1:6379/") { 8 | Ok(mut subscriber) => { 9 | assert!(!subscriber.is_connection_open()); 10 | 11 | let mut result = subscriber.subscribe("int_pub_sub"); 12 | assert!(result.is_ok()); 13 | 14 | thread::spawn(|| { 15 | thread::sleep(time::Duration::from_secs(2)); 16 | 17 | match simple_redis::create("redis://127.0.0.1:6379/") { 18 | Ok(mut publisher) => { 19 | assert!(!publisher.is_connection_open()); 20 | 21 | let result = publisher.publish("int_pub_sub", "test pub_sub message"); 22 | assert!(result.is_ok()); 23 | 24 | assert!(publisher.is_connection_open()); 25 | } 26 | _ => panic!("test error"), 27 | }; 28 | }); 29 | 30 | subscriber 31 | .fetch_messages( 32 | &mut |message: Message| -> bool { 33 | let payload: String = message.get_payload().unwrap(); 34 | assert_eq!(payload, "test pub_sub message"); 35 | true 36 | }, 37 | &mut || -> Interrupts { Interrupts::new() }, 38 | ) 39 | .unwrap(); 40 | 41 | result = subscriber.subscribe("int_pub_sub2"); 42 | assert!(result.is_ok()); 43 | 44 | result = subscriber.unsubscribe("int_pub_sub"); 45 | assert!(result.is_ok()); 46 | 47 | thread::spawn(|| { 48 | thread::sleep(time::Duration::from_secs(2)); 49 | 50 | match simple_redis::create("redis://127.0.0.1:6379/") { 51 | Ok(mut publisher) => { 52 | assert!(!publisher.is_connection_open()); 53 | 54 | let mut result = publisher.publish("int_pub_sub", "bad"); 55 | assert!(result.is_ok()); 56 | 57 | assert!(publisher.is_connection_open()); 58 | 59 | thread::sleep(time::Duration::from_secs(1)); 60 | 61 | result = publisher.publish("int_pub_sub2", "good"); 62 | assert!(result.is_ok()); 63 | } 64 | _ => panic!("test error"), 65 | }; 66 | }); 67 | 68 | subscriber 69 | .fetch_messages( 70 | &mut |message: Message| -> bool { 71 | let payload: String = message.get_payload().unwrap(); 72 | assert_eq!(payload, "good"); 73 | true 74 | }, 75 | &mut || -> Interrupts { Interrupts::new() }, 76 | ) 77 | .unwrap(); 78 | 79 | thread::spawn(|| { 80 | thread::sleep(time::Duration::from_secs(2)); 81 | 82 | match simple_redis::create("redis://127.0.0.1:6379/") { 83 | Ok(mut publisher) => { 84 | assert!(!publisher.is_connection_open()); 85 | 86 | let mut result = publisher.publish("int_pub_sub", "bad"); 87 | assert!(result.is_ok()); 88 | 89 | assert!(publisher.is_connection_open()); 90 | 91 | thread::sleep(time::Duration::from_secs(1)); 92 | 93 | result = publisher.publish("int_pub_sub2", "good"); 94 | assert!(result.is_ok()); 95 | } 96 | _ => panic!("test error"), 97 | }; 98 | }); 99 | 100 | let mut counter = 0; 101 | subscriber 102 | .fetch_messages( 103 | &mut |_message: Message| -> bool { 104 | panic!("test error"); 105 | }, 106 | &mut || -> Interrupts { 107 | counter = counter + 1; 108 | 109 | let mut interrupts = Interrupts::new(); 110 | interrupts.stop = counter == 5; 111 | interrupts.next_polling_time = Some(10); 112 | 113 | interrupts 114 | }, 115 | ) 116 | .unwrap(); 117 | } 118 | _ => panic!("test error"), 119 | }; 120 | } 121 | 122 | #[test] 123 | fn pub_psub() { 124 | match simple_redis::create("redis://127.0.0.1:6379/") { 125 | Ok(mut subscriber) => { 126 | assert!(!subscriber.is_connection_open()); 127 | 128 | let mut result = subscriber.psubscribe("int_pub_psub::*"); 129 | assert!(result.is_ok()); 130 | 131 | thread::spawn(|| { 132 | thread::sleep(time::Duration::from_secs(2)); 133 | 134 | match simple_redis::create("redis://127.0.0.1:6379/") { 135 | Ok(mut publisher) => { 136 | assert!(!publisher.is_connection_open()); 137 | 138 | let result = publisher.publish("int_pub_psub::123", "test pub_sub message"); 139 | assert!(result.is_ok()); 140 | 141 | assert!(publisher.is_connection_open()); 142 | } 143 | _ => panic!("test error"), 144 | }; 145 | }); 146 | 147 | subscriber 148 | .fetch_messages( 149 | &mut |message: Message| -> bool { 150 | let payload: String = message.get_payload().unwrap(); 151 | assert_eq!(payload, "test pub_sub message"); 152 | true 153 | }, 154 | &mut || -> Interrupts { Interrupts::new() }, 155 | ) 156 | .unwrap(); 157 | 158 | result = subscriber.psubscribe("int_pub_psub2::*"); 159 | assert!(result.is_ok()); 160 | 161 | result = subscriber.punsubscribe("int_pub_psub::*"); 162 | assert!(result.is_ok()); 163 | 164 | thread::spawn(|| { 165 | thread::sleep(time::Duration::from_secs(2)); 166 | 167 | match simple_redis::create("redis://127.0.0.1:6379/") { 168 | Ok(mut publisher) => { 169 | assert!(!publisher.is_connection_open()); 170 | 171 | let mut result = publisher.publish("int_pub_psub::123", "bad"); 172 | assert!(result.is_ok()); 173 | 174 | assert!(publisher.is_connection_open()); 175 | 176 | thread::sleep(time::Duration::from_secs(1)); 177 | 178 | result = publisher.publish("int_pub_psub2::123", "good"); 179 | assert!(result.is_ok()); 180 | } 181 | _ => panic!("test error"), 182 | }; 183 | }); 184 | 185 | subscriber 186 | .fetch_messages( 187 | &mut |message: Message| -> bool { 188 | let payload: String = message.get_payload().unwrap(); 189 | assert_eq!(payload, "good"); 190 | true 191 | }, 192 | &mut || -> Interrupts { Interrupts::new() }, 193 | ) 194 | .unwrap(); 195 | } 196 | _ => panic!("test error"), 197 | }; 198 | } 199 | -------------------------------------------------------------------------------- /docs/api/type.impl/simple_redis/types/enum.RedisError.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var type_impls = Object.fromEntries([["simple_redis",[["
Source§

impl Debug for RedisError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
","Debug","simple_redis::RedisError"],["
Source§

impl Display for RedisError

Source§

fn fmt(&self, format: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter.

\n
","Display","simple_redis::RedisError"],["
Source§

impl Error for RedisError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
","Error","simple_redis::RedisError"]]]]); 3 | if (window.register_type_impls) { 4 | window.register_type_impls(type_impls); 5 | } else { 6 | window.pending_type_impls = type_impls; 7 | } 8 | })() 9 | //{"start":55,"fragment_lengths":[7945]} --------------------------------------------------------------------------------