Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

- Bugfix: Missing CPR arguments causes panic
- Switched dependency termion to crossterm for setting the raw mode in the std examples for windows compatibility
- Split the modules up into directories for better visibility

## [0.5.0 - 2024-12-12]

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"

members = [
"noline",
Expand Down
4 changes: 2 additions & 2 deletions examples/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tokio = { version = "1.38.0", features = [
tokio = { version = "1.44.2", features = [
"full",
"io-util",
"sync",
Expand All @@ -16,9 +16,9 @@ tokio = { version = "1.38.0", features = [
] }
noline = { path = "../../noline", features = ["std"] }
heapless = "0.8.0"
termion = "4.0.0"
embedded-io-async = "0.6.1"
embedded-io = "0.6.1"
crossterm = "0.29.0"

[[bin]]
name = "std-sync"
Expand Down
6 changes: 3 additions & 3 deletions examples/std/src/bin/std-async-tokio.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use embedded_io_async::Write;
use crossterm::terminal::{disable_raw_mode, enable_raw_mode};
use noline::builder::EditorBuilder;
use termion::raw::IntoRawMode;

use tokio::io;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
Expand Down Expand Up @@ -43,7 +42,7 @@ impl embedded_io_async::Write for IOWrapper {
#[tokio::main(flavor = "current_thread")]
async fn main() {
let term_task = tokio::spawn(async {
let _raw_term = std::io::stdout().into_raw_mode().unwrap();
enable_raw_mode().unwrap();
let mut io = IOWrapper::new();

let prompt = "> ";
Expand All @@ -58,6 +57,7 @@ async fn main() {
let s = format!("Read: '{}'\n\r", line);
io.stdout.write_all(s.as_bytes()).await.unwrap();
}
disable_raw_mode().unwrap();
});

match term_task.await {
Expand Down
9 changes: 4 additions & 5 deletions examples/std/src/bin/std-sync.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use noline::builder::EditorBuilder;
use std::io;
use termion::raw::IntoRawMode;

use crossterm::terminal::{disable_raw_mode, enable_raw_mode};
use embedded_io::{ErrorType, Read as EmbRead, Write as EmbWrite};
use noline::builder::EditorBuilder;
use std::io::{Read, Stdin, Stdout, Write};

pub struct IOWrapper {
Expand Down Expand Up @@ -45,7 +43,7 @@ impl EmbWrite for IOWrapper {
}

fn main() {
let _stdout = io::stdout().into_raw_mode().unwrap();
enable_raw_mode().unwrap();
let prompt = "> ";

let mut io = IOWrapper::new();
Expand All @@ -58,4 +56,5 @@ fn main() {
while let Ok(line) = editor.readline(prompt, &mut io) {
writeln!(io, "Read: '{}'", line).unwrap();
}
disable_raw_mode().unwrap();
}
6 changes: 3 additions & 3 deletions noline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ include = ["**/*.rs", "Cargo.toml"]
[dependencies]
embedded-io = "0.6.1"
embedded-io-async = "0.6.1"
num_enum = { version = "0.7.2", default-features = false }
num_enum = { version = "0.7.3", default-features = false }


[features]
Expand All @@ -25,8 +25,8 @@ std = ["embedded-io/std", "embedded-io-async/std"]
alloc = []

[dev-dependencies]
crossbeam = "0.8.1"
termion = "4.0.0"
crossbeam = "0.8.4"
crossterm = "0.29.0"

[package.metadata.docs.rs]
all-features = true
Loading