github.com
...use x509_parser::prelude::*; static IGCA_DER: &[u8] = include_bytes!("../assets/IGC_A.der"); let res = X509Certificate::from_der(IGCA_DER); match res { Ok((rem, cert)) => { assert!(rem.is_empty()); // assert_eq!(cert.version(), X509Version::V3); }, _ => panic!("x509 parsing failed: {:?}", res), } To parse a CRL and print information about revoked...
Crate
v0.18.1
2026-02-05
rust-analyzer.github.io
#11869 (first contribution) allow tildes as code block fences:
#11866 (first contribution) avoid underflows in range conversion.
#11857, #11886 decrease relevance of postfix completions.
#11840 fix another const generic panic.
#11842 fix duplicate type mismatches with blocks.
#11844 fix divergence detection for bare match arms.
#11852 expand asm! to infinite...
Project/Tooling Updates
2022-04-06
~1 min read
rust-analyzer.github.io
...the augmentsSyntaxTokens capability on VS Code.
#14802 fix layout for hir_ty::Ty and friends.
#14820 expand format_args! with more details.
#14851 handle match scrutinee in closure captures.
#14855 consider block impls in lookup_impl_assoc_item_for_trait_ref.
#14863 consider all tokens in macro calls when analyzing...
Project/Tooling Updates
2023-05-24
~1 min read
gitlab.com
...Cursor Position Cursor {Up, Down, Forward, Backward} Cursor {Save, Restore} Erase Display Erase Line Set Graphics mode Set/Reset Text Mode Usage let text = "\x1b[31;1;4mHello World\x1b[0m"; for e in parse_ansi(text) { match e.kind() { ElementKind::Text => { println!("Got a text: {:?}", &text[e.range()],); } _ => { println...
Crate
v0.3.0
2025-01-30
doc.rust-lang.org
pub fn contains_key<Q>(&self, key: &Q) -> bool
...The key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type.
Examples
use std::collections::BTreeMap;
let mut map = BTreeMap::new();
map.insert(1, "a");
assert_eq!(map.contains_key(&1), true);
assert...
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub macro ready!
...let num = match fut.poll(cx) {
Poll::Ready(t) => t,
Poll::Pending => return Poll::Pending,
};
macro
core
Stable since 1.64.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn contains_key<Q>(&self, k: &Q) -> bool
...The key may be any borrowed form of the map's key type, but Hash and Eq on the borrowed form must match those for the key type.
Examples
use std::collections::HashMap;
let mut map = HashMap::new();
map.insert(1, "a");
assert_eq!(map.contains_key(&1), true);
assert...
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn remove<Q>(&mut self, value: &Q) -> bool
...The value may be any borrowed form of the set's value type, but Hash and Eq on the borrowed form must match those for the value type.
Examples
use std::collections::HashSet;
let mut set = HashSet::new();
set.insert(2);
assert_eq!(set.remove(&2), true);
assert_eq!(set...
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn accept(&self) -> io::Result<(UnixStream, SocketAddr)>
...Examples
use std::os::unix::net::UnixListener;
fn main() -> std::io::Result<()> {
let listener = UnixListener::bind("/path/to/the/socket")?;
match listener.accept() {
Ok((socket, addr)) => println!("Got a client: {addr:?}"),
Err(e) => println!("accept function failed: {e:?}"),
}
Ok(())
}
method
std
Stable since 1.10.0
Version 1.100.0-nightly
github.com
...If code only cares about the `values` and `formats` fields, working
with a struct variant is nicer:
```rust
match msg {
// you can reorder too!
Bind { values, formats, .. } => ...
// ...
}
```
versus
```rust
match msg {
Bind(_, _, formats, values, _) => ...
// ...
}
```
This feature gate was originally put in place because there were many serious
bugs in the...
RFC 418
RFC
2014-10-25
~2 min read
notes.eatonphil.com
...Vec<char> = contents.chars().collect();
let tokens = match lex::lex(&raw) {
Ok(tokens) => tokens,
Err(msg) => panic!("{}", msg),
};
let ast = match parse::parse(&raw, tokens) {
Ok(ast) => ast,
Err(msg) => panic!("{}", msg),
};
let pgrm = eval::compile(&raw, ast);
eval::eval(pgrm);
}
Easy peasy. Now let's implement lex.
Lexical analysisLexical...
Rust Walkthroughs
2021-12-29
~25 min read
docs.rs
...MacroArgs = match syn::parse(args) { Ok(v) => v, Err(e) => { return e.to_compile_error().into(); } }; let _input = syn::parse_macro_input!(input as ItemFn); // do things with `args` unimplemented!() } Consuming Code use your_crate::your_attr; #[your_attr(path = "hello", timeout_ms = 15)] fn do_stuff() { println!("Hello"); } Features...
Crate
v0.24.1
2026-08-20
doc.rust-lang.org
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
...The key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type.
Examples
use std::collections::BTreeMap;
let mut map = BTreeMap::new();
map.insert(1, "a");
if let Some(x) = map.get_mut(&1...
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn align(&self) -> Option<Alignment>
...Examples
use std::fmt::{self, Alignment};
struct Foo;
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let s = if let Some(s) = formatter.align() {
match s {
Alignment::Left => "left",
Alignment::Right => "right",
Alignment::Center => "center",
}
} else {
"into the void"
};
write!(formatter, "{s}")
}
}
assert_eq...
method
core
Stable since 1.28.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
...The key may be any borrowed form of the map's key type, but Hash and Eq on the borrowed form must match those for the key type.
Examples
use std::collections::HashMap;
let mut map = HashMap::new();
map.insert(1, "a");
if let Some(x) = map.get_mut(&1...
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn _mm_set_ps(a: f32, b: f32, c: f32, d: f32) -> __m128
...This matches the standard way of writing bit patterns on x86:
bit 127 .. 96 95 .. 64 63 .. 32 31 .. 0
+---------+---------+---------+---------+
| a | b | c | d | result
+---------+---------+---------+---------+
Alternatively:
let v = _mm_set_ps(d, c, b, a);
Intel's documentation
function
core
Stable since 1.27.0
Version 1.100.0-nightly
quickwit.io
...The query parser already supports this feature, for instance "quickwit tan"* will match documents containing "quickwit tantivy" and "quickwit tango".Regex tokenizer: Tokenization based on regex patterns.Coerce option: Convert values instead of returning an error during indexing.Slop in phrase queries supports now transpositions. "quickwit tantivy"~2 will match...
Project/Tooling Updates
2023-06-21
~2 min read
git-cliff.org
...Thanks to @Kriskras99 for implementing this in #1173!
🧮 Support matching arrays via parsers
The commit parser has been extended to support regex matching on array values, such as remote.pr_labels.
For example, this makes it possible to group commits based on their GitHub labels as follows:
[git]commit...
Project/Tooling Updates
2025-07-30
~4 min read
poor.dev
...To make this work, we intercept this instruction in the rendered bytes with a regex, changing the document.title to match:
wsTerminal.onmessage = function (event) {
// ...
let data = event.data;
const titleRegex = /\x1b\]0;([^\x07\x1b]*?)(?:\x07|\x1b\\)/g;
let match;
while ((match = titleRegex.exec(data)) !== null) {
document.title = match[1...
Observations/Thoughts
2025-08-20
~12 min read