Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch parser to multi-byte processing #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
21 changes: 10 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@ name = "vte"
edition = "2021"
rust-version = "1.62.1"

[dependencies]
arrayvec = { version = "0.7.2", default-features = false, optional = true }
bitflags = { version = "2.3.3", default-features = false, optional = true }
cursor-icon = { version = "1.0.0", default-features = false, optional = true }
log = { version = "0.4.17", optional = true }
serde = { version = "1.0.160", features = ["derive"], optional = true }
utf8parse = { version = "0.2.0", path = "utf8parse" }
vte_generate_state_changes = { version = "0.1.0", path = "vte_generate_state_changes" }
[workspace]
members = ["vte_generate_state_changes"]

[features]
ansi = ["log", "cursor-icon", "bitflags"]
default = ["no_std"]
nightly = ["utf8parse/nightly"]
no_std = ["arrayvec"]
serde = ["dep:serde"]

[workspace]
members = ["utf8parse", "vte_generate_state_changes"]
[dependencies]
arrayvec = { version = "0.7.2", default-features = false, optional = true }
bitflags = { version = "2.3.3", default-features = false, optional = true }
cursor-icon = { version = "1.0.0", default-features = false, optional = true }
log = { version = "0.4.17", optional = true }
memchr = "2.7.4"
serde = { version = "1.0.160", features = ["derive"], optional = true }
vte_generate_state_changes = { version = "0.1.0", path = "vte_generate_state_changes" }
6 changes: 1 addition & 5 deletions examples/parselog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ fn main() {
loop {
match handle.read(&mut buf) {
Ok(0) => break,
Ok(n) => {
for byte in &buf[..n] {
statemachine.advance(&mut performer, *byte);
}
},
Ok(n) => statemachine.advance(&mut performer, &buf[..n]),
Copy link
Contributor

@nixpulvis nixpulvis Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect most people not to have trouble migrating, especially given how nice this example's change is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect most people not to have trouble migrating, especially given how nice this example's change is.

Yes I agree that most people will likely have less code after migration, since most implementations already were using buffers anyway. That's one of the motivating factors behind this patch and also why I wanted to intentionally break things to make people aware of the faster API.

Err(err) => {
println!("err: {}", err);
break;
Expand Down
6 changes: 5 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
format_code_in_doc_comments = true
group_imports = "StdExternalCrate"
match_block_trailing_comma = true
condense_wildcard_suffixes = true
use_field_init_shorthand = true
normalize_doc_attributes = true
overflow_delimited_expr = true
imports_granularity = "Module"
format_macro_matchers = true
use_small_heuristics = "Max"
hex_literal_case = "Upper"
normalize_comments = true
reorder_impl_items = true
use_try_shorthand = true
newline_style = "Unix"
format_strings = true
wrap_comments = true
comment_width = 100
Loading