{"id":20089949,"url":"https://github.com/bugadani/debounce","last_synced_at":"2025-09-04T07:40:26.558Z","repository":{"id":77144862,"uuid":"261124992","full_name":"bugadani/Debounce","owner":"bugadani","description":"Simple debouncer library written in Rust","archived":false,"fork":false,"pushed_at":"2020-05-04T11:52:12.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T15:28:32.435Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bugadani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-04T08:57:31.000Z","updated_at":"2020-05-04T11:52:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"bbee74af-ed6e-4ff7-a2d2-51d530761ea2","html_url":"https://github.com/bugadani/Debounce","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bugadani/Debounce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugadani%2FDebounce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugadani%2FDebounce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugadani%2FDebounce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugadani%2FDebounce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bugadani","download_url":"https://codeload.github.com/bugadani/Debounce/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugadani%2FDebounce/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273574111,"owners_count":25129882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T16:20:59.311Z","updated_at":"2025-09-04T07:40:26.424Z","avatar_url":"https://github.com/bugadani.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Debounce\n=========\n\nDebounce is a Rust library used to process noisy binary state transitions, like button presses in embedded systems.\n\nCreating a debouncer\n--------------------\n\n_**Note**: Debounce works by counting consecutive samples, so you'll need to figure out how many samples you need to consider the input **stable**._\n\nAs an example we want to process button presses. We determine, that 2 consecutive samples are enough to consider our input stable.\n\n```rust\nuse debounce::{Debounce, State, Change};\nuse debounce::consts::U2; // 2 samples for stable signal\n\nlet debounce: Debounce\u003cU2\u003e = Debounce::new(State::Released);\n```\n\nFeeding data\n------------\n\nYou can feed data into debouncer using the `update` method. Update takes the current state of your input as a `State`, which can be either `State::Touched` or `State::Released`.\n\nYou may also use `.into()` on a `bool` to convert it into `State`. `true` will be converted to `State::Touched` and false to `State::Released`.\n\nObserving state\n---------------\n\n`update` returns with a `Change` value that indicates what happened. A `Change` can have three values:\n\n * `Change::Touched` or `Change::Released` when the internal state changes.\n * `Change::NoChange(state)` when input does not change the internal state. `state` will contain the current stable signal state, which can be diferent from the input state.\n\n_Note: if you only care about the signal state and not the change, you can use `.into()` to convert the `Change` value to a corresponding `State` value._\n\nYou can also use the `state` method that returns a `State` value that indicated the current stable signal state.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugadani%2Fdebounce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbugadani%2Fdebounce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugadani%2Fdebounce/lists"}