Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
welf committed Jan 16, 2025
1 parent 169e6a8 commit f029913
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
19 changes: 16 additions & 3 deletions src-code-context/code_context.rs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ pub trait Processor {
/// This is a required method
fn no_comments(&self) -> bool;
/// This is a required method
fn no_function_body(&self) -> bool;
/// This is a required method
fn process_file(&self, input: &Path, output: &Path) -> Result<(usize, usize)>;
/// There is a default implementation
fn process_directory_to_single_file(
Expand All @@ -48,16 +50,23 @@ pub trait Processor {
}
pub struct FileProcessor {
no_comments: bool,
no_function_bodies: bool,
dry_run: bool,
single_file: bool,
}
impl FileProcessor {
pub fn with_options(no_comments: bool, dry_run: bool, single_file: bool) -> Self {}
pub fn with_options(
no_comments: bool,
no_function_bodies: bool,
dry_run: bool,
single_file: bool,
) -> Self {}
}
impl Processor for FileProcessor {
fn dry_run(&self) -> bool {}
fn single_file(&self) -> bool {}
fn no_comments(&self) -> bool {}
fn no_function_body(&self) -> bool {}
fn process_file(&self, input: &Path, output: &Path) -> Result<(usize, usize)> {}
}

Expand Down Expand Up @@ -102,7 +111,10 @@ struct Cli {
/// Remove all comments (including doc comments)
#[arg(long)]
no_comments: bool,
/// Print processing statistics
/// Remove function bodies except for string/serialization methods
#[arg(long)]
no_function_bodies: bool,
/// Don't print processing statistics
#[arg(long)]
no_stats: bool,
/// Run without writing output files
Expand Down Expand Up @@ -136,10 +148,11 @@ impl RustAnalyzer {
}
pub struct CodeTransformer {
no_comments: bool,
no_function_bodies: bool,
}
impl CodeTransformer {
/// Creates a new CodeTransformer instance
pub fn new(no_comments: bool) -> Self {}
pub fn new(no_comments: bool, no_function_bodies: bool) -> Self {}
/// Gets attributes from any Item type
fn get_attrs(item: &Item) -> &[Attribute] {}
/// Gets mutable attributes from any Item type
Expand Down
5 changes: 4 additions & 1 deletion src-custom-suffix/main.rs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ struct Cli {
/// Remove all comments (including doc comments)
#[arg(long)]
no_comments: bool,
/// Print processing statistics
/// Remove function bodies except for string/serialization methods
#[arg(long)]
no_function_bodies: bool,
/// Don't print processing statistics
#[arg(long)]
no_stats: bool,
/// Run without writing output files
Expand Down
11 changes: 10 additions & 1 deletion src-custom-suffix/processor.rs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub trait Processor {
/// This is a required method
fn no_comments(&self) -> bool;
/// This is a required method
fn no_function_body(&self) -> bool;
/// This is a required method
fn process_file(&self, input: &Path, output: &Path) -> Result<(usize, usize)>;
/// There is a default implementation
fn process_directory_to_single_file(
Expand All @@ -45,15 +47,22 @@ pub trait Processor {
}
pub struct FileProcessor {
no_comments: bool,
no_function_bodies: bool,
dry_run: bool,
single_file: bool,
}
impl FileProcessor {
pub fn with_options(no_comments: bool, dry_run: bool, single_file: bool) -> Self {}
pub fn with_options(
no_comments: bool,
no_function_bodies: bool,
dry_run: bool,
single_file: bool,
) -> Self {}
}
impl Processor for FileProcessor {
fn dry_run(&self) -> bool {}
fn single_file(&self) -> bool {}
fn no_comments(&self) -> bool {}
fn no_function_body(&self) -> bool {}
fn process_file(&self, input: &Path, output: &Path) -> Result<(usize, usize)> {}
}
3 changes: 2 additions & 1 deletion src-custom-suffix/transformer.rs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ impl RustAnalyzer {
}
pub struct CodeTransformer {
no_comments: bool,
no_function_bodies: bool,
}
impl CodeTransformer {
/// Creates a new CodeTransformer instance
pub fn new(no_comments: bool) -> Self {}
pub fn new(no_comments: bool, no_function_bodies: bool) -> Self {}
/// Gets attributes from any Item type
fn get_attrs(item: &Item) -> &[Attribute] {}
/// Gets mutable attributes from any Item type
Expand Down

0 comments on commit f029913

Please sign in to comment.