Skip to content

Commit

Permalink
feat: Scanner.set_module_output now return &mut Scanner.
Browse files Browse the repository at this point in the history
This makes the API more ergonomic, allowing to chain method calls.
  • Loading branch information
plusvic committed Jan 22, 2025
1 parent 2b69aee commit 2d3ce59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/src/scanner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ impl<'r> Scanner<'r> {
pub fn set_module_output(
&mut self,
data: Box<dyn MessageDyn>,
) -> Result<(), ScanError> {
) -> Result<&mut Self, ScanError> {
let descriptor = data.descriptor_dyn();
let full_name = descriptor.full_name();

Expand All @@ -481,7 +481,7 @@ impl<'r> Scanner<'r> {
.user_provided_module_outputs
.insert(full_name.to_string(), data);

Ok(())
Ok(self)
}

/// Similar to [`Scanner::set_module_output`], but receives a module name
Expand All @@ -494,7 +494,7 @@ impl<'r> Scanner<'r> {
&mut self,
name: &str,
data: &[u8],
) -> Result<(), ScanError> {
) -> Result<&mut Self, ScanError> {
// Try to find the module by name first, if not found, then try
// to find a module where the fully-qualified name for its protobuf
// message matches the `name` arguments.
Expand Down

0 comments on commit 2d3ce59

Please sign in to comment.