Skip to content

Commit 2d3ce59

Browse files
committed
feat: Scanner.set_module_output now return &mut Scanner.
This makes the API more ergonomic, allowing to chain method calls.
1 parent 2b69aee commit 2d3ce59

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/src/scanner/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ impl<'r> Scanner<'r> {
461461
pub fn set_module_output(
462462
&mut self,
463463
data: Box<dyn MessageDyn>,
464-
) -> Result<(), ScanError> {
464+
) -> Result<&mut Self, ScanError> {
465465
let descriptor = data.descriptor_dyn();
466466
let full_name = descriptor.full_name();
467467

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

484-
Ok(())
484+
Ok(self)
485485
}
486486

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

0 commit comments

Comments
 (0)