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 mut list = LocList::read_str(input, Language::Rust).unwrap();
list.sort_around_line_index(5).unwrap();
assert_eq!(list.to_string(), output);
Modules§
Macros§
- line_
number - A macro to create a
LineNumber
from a literal
Structs§
- Brace
Stack - CharSet
- Focused
- Gift
- Something that can maybe satisfy a wish
- Line
Number - A 1-based line number, as used in most text editors
- Line
Number Range - A range of 1-based line numbers, both ends included
- Line
Number Range Iter - Loc
- A Line of Code, analyzed.
- LocList
- A list of Lines of Code
- Wish
- Something that is required by the state of a LOC list
Enums§
- Analyzer
- CsError
- An error in codesort
- Language
- The language syntax to use for analyzing the code
- Spacing
- The kind of spacing between blocs