We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
from_bytes
1 parent 6e103b1 commit 609a734Copy full SHA for 609a734
glib/src/bytes.rs
@@ -109,7 +109,7 @@ impl Bytes {
109
Bound::Excluded(v) => v.checked_add(1).expect("Invalid start offset"),
110
Bound::Unbounded => 0,
111
};
112
- assert!(start_offset < len, "Start offset after valid range");
+ assert!(start_offset <= len, "Start offset after valid range");
113
114
let end_offset = match range.end_bound() {
115
Bound::Included(v) => v.checked_add(1).expect("Invalid end offset"),
@@ -338,6 +338,8 @@ mod tests {
338
assert_eq!(b2, [1u8, 2u8].as_ref());
339
let b2 = Bytes::from_bytes(&b1, ..);
340
assert_eq!(b2, [1u8, 2u8, 3u8].as_ref());
341
+ let b2 = Bytes::from_bytes(&b1, 3..);
342
+ assert_eq!(b2, [].as_ref());
343
}
344
345
#[test]
0 commit comments