{"id":17209363,"url":"https://github.com/de-vri-es/serial2-rs","last_synced_at":"2025-04-10T19:10:25.718Z","repository":{"id":49688531,"uuid":"418253005","full_name":"de-vri-es/serial2-rs","owner":"de-vri-es","description":"Cross platform serial ports for Rust","archived":false,"fork":false,"pushed_at":"2024-04-23T12:02:28.000Z","size":219,"stargazers_count":35,"open_issues_count":3,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-01T13:39:20.271Z","etag":null,"topics":["hacktoberfest","rust","serial"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/de-vri-es.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2021-10-17T20:52:48.000Z","updated_at":"2024-06-13T18:14:01.075Z","dependencies_parsed_at":"2023-12-16T13:59:19.124Z","dependency_job_id":"887b6033-00a3-4ec9-9eb2-f8982850a8db","html_url":"https://github.com/de-vri-es/serial2-rs","commit_stats":{"total_commits":88,"total_committers":1,"mean_commits":88.0,"dds":0.0,"last_synced_commit":"5b0c01a2be59a35f19b1c3f5bec128ad02678bec"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-vri-es%2Fserial2-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-vri-es%2Fserial2-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-vri-es%2Fserial2-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-vri-es%2Fserial2-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/de-vri-es","download_url":"https://codeload.github.com/de-vri-es/serial2-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248279543,"owners_count":21077407,"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","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":["hacktoberfest","rust","serial"],"created_at":"2024-10-15T02:51:24.826Z","updated_at":"2025-04-10T19:10:25.699Z","avatar_url":"https://github.com/de-vri-es.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# serial2\n\nSerial port communication for Rust.\n\nThe `serial2` crate provides a cross-platform interface to serial ports.\nIt aims to provide a simpler interface than other alternatives.\n\nCurrently supported features:\n* Simple interface: one [`SerialPort`] struct for all supported platforms.\n* List available ports.\n* Custom baud rates on all supported platforms except Solaris and Illumos.\n* Concurrent reads and writes from multiple threads, even on Windows.\n* Purge the OS buffers (useful to discard read noise when the line should have been silent, for example).\n* Read and control individual modem status lines to use them as general purpose I/O.\n* Cross platform configuration of serial port settings:\n  * Baud rate\n  * Character size\n  * Stop bits\n  * Parity checks\n  * Flow control\n  * Read/write timeouts\n* Full access to platform specific serial port settings using target specific feature flags (`\"unix\"` or `\"windows\"`).\n\nYou can open and configure a serial port in one go with [`SerialPort::open()`].\nThe second argument to `open()` must be a type that implements [`IntoSettings`].\nIn the simplest case, it is enough to pass a `u32` for the baud rate.\nDoing that will also configure a character size of 8 bits with 1 stop bit and disables parity checks and flow control.\nFor full control over the applied settings, pass a closure that receives the the current [`Settings`] and return the desired settings.\nIf you do, you will almost always want to call [`Settings::set_raw()`] before changing any other settings.\n\nThe standard [`std::io::Read`] and [`std::io::Write`] traits are implemented for [`SerialPort`] and  [`\u0026SerialPort`][`SerialPort`].\nThis allows you to use the serial port concurrently from multiple threads through a non-mutable reference.\n\nThere are also non-trait [`read()`][SerialPort::read()] and [`write()`][SerialPort::write()] functions,\nso you can use the serial port without importing any traits.\nThese take `\u0026self`, so they can also be used from multiple threads concurrently.\n\nThe [`SerialPort::available_ports()`] function can be used to get a list of available serial ports on supported platforms.\n\n## Example\nThis example opens a serial port and echoes back everything that is read.\n\n```rust\nuse serial2::SerialPort;\n\n// On Windows, use something like \"COM1\" or \"COM15\".\nlet port = SerialPort::open(\"/dev/ttyUSB0\", 115200)?;\nlet mut buffer = [0; 256];\nloop {\n    let read = port.read(\u0026mut buffer)?;\n    port.write(\u0026buffer[..read])?;\n}\n```\n\n[`SerialPort`]: https://docs.rs/serial2/latest/serial2/struct.SerialPort.html\n[`SerialPort::open()`]: https://docs.rs/serial2/latest/serial2/struct.SerialPort.html#method.open\n[`IntoSettings`]: https://docs.rs/serial2/latest/serial2/trait.IntoSettings.html\n[`Settings`]: https://docs.rs/serial2/latest/serial2/struct.Settings.html\n[`Settings::set_raw()`]: https://docs.rs/serial2/latest/serial2/struct.Settings.html#method.set_raw\n[`std::io::Read`]: https://doc.rust-lang.org/stable/std/io/trait.Read.html\n[`std::io::Write`]: https://doc.rust-lang.org/stable/std/io/trait.Write.html\n[SerialPort::read()]: https://docs.rs/serial2/latest/serial2/struct.SerialPort.html#method.read\n[SerialPort::write()]: https://docs.rs/serial2/latest/serial2/struct.SerialPort.html#method.write\n[`SerialPort::available_ports()`]: https://docs.rs/serial2/latest/serial2/struct.SerialPort.html#method.available_ports\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fde-vri-es%2Fserial2-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fde-vri-es%2Fserial2-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fde-vri-es%2Fserial2-rs/lists"}