Expand description
codesort sorts code, either as a command line tool, usually integrated in an IDE or a text editor, or as a library.
use codesort::{LocList, Language};
let input = r#"
pub enum ContentSearchResult {
/// the file wasn't searched because it's binary or too big
NotSuitable,
/// the needle has been found at the given pos
Found {
pos: usize,
},
/// the needle hasn't been found
NotFound, // no match
}
"#;
let output = r#"
pub enum ContentSearchResult {
/// the needle has been found at the given pos
Found {
pos: usize,
},
/// the needle hasn't been found
NotFound, // no match
/// the file wasn't searched because it's binary or too big
NotSuitable,
}
"#;
let list = LocList::read_str(input, Language::Rust).unwrap();
let focused = list.focus_around_line_index(5).unwrap();
assert_eq!(
focused.sort().to_string(),
output,
);Modules§
Structs§
- Something that can maybe satisfy a wish
- A 1-based line number, as used in most text editors
- A range of 1-based line numbers, both ends included
- A Line of Code, analyzed.
- A list of Lines of Code
- Something that is required by the state of a LOC list
Enums§
- An error in codesort
- The language syntax to use for analyzing the code
- The kind of spacing between blocs
Functions§
Type Aliases§
- A 0-based line index