Examples

Page 19 of 50

Browse code examples

rustSnippet

io Error Other Boxed Failures

Wrap arbitrary failure strings into a real io::Error with Error::other, then classify both custom and filesystem errors by their ErrorKind.

rustSnippet

Range Patterns Cover Match Arms

Fold consecutive exit codes into named bands with range patterns: literal ranges like 64..=78 become match arms, and char ranges classify tokens too.

rustSnippet

Shared Tree Nodes Rc RefCell

Let several parents share child nodes through Rc<RefCell<Vec>>: Rc clones share ownership without copying, RefCell mutates inside an immutable shell.

sqlSnippet

COUNT Star Versus COUNT Column

COUNT(*) counts every row while COUNT(col) skips NULLs — so they disagree on sparse columns, and COUNT(DISTINCT col) collapses repeats before skipping NULLs.