-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix stream bugs, logging improvements logging improvements allow replacing inbox id with a name (alix, bo, eve, etc) in test logs fix duplicate messages in streams by removing drain() and improving stream all missing test move commit lock from being global to existing in the client. This avoids interference with tests that use lots of clients fix http-stream de-serialization errors because of a bug handling extra un-serialized bytes instrument every api function
- Loading branch information
Showing
21 changed files
with
338 additions
and
179 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
pub fn truncate_hex(hex_string: impl AsRef<str>) -> String { | ||
let hex_string = hex_string.as_ref(); | ||
// If empty string, return it | ||
if hex_string.is_empty() { | ||
return String::new(); | ||
} | ||
|
||
let hex_value = if let Some(hex_value) = hex_string.strip_prefix("0x") { | ||
hex_value | ||
} else { | ||
hex_string | ||
}; | ||
|
||
// If the hex value is 8 or fewer chars, return original string | ||
if hex_value.len() <= 8 { | ||
return hex_string.to_string(); | ||
} | ||
|
||
format!( | ||
"0x{}...{}", | ||
&hex_value[..4], | ||
&hex_value[hex_value.len() - 4..] | ||
) | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_long_hex() { | ||
assert_eq!( | ||
truncate_hex("0x5bf078bd83995fe83092d93c5655f059"), | ||
"0x5bf0...f059" | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.