Skip to content

Commit 708b080

Browse files
authored
Update lib.rs
1 parent 70ec773 commit 708b080

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,23 @@ impl AddAssign<ByteSize> for ByteSize {
256256
}
257257
}
258258

259+
impl<T> Add<T> for ByteSize
260+
where T: Into<u64> {
261+
type Output = ByteSize;
262+
#[inline(always)]
263+
fn add(self, rhs: T) -> ByteSize {
264+
ByteSize(self.0 + (rhs.into() as u64))
265+
}
266+
}
267+
268+
impl<T> AddAssign<T> for ByteSize
269+
where T: Into<u64> {
270+
#[inline(always)]
271+
fn add_assign(&mut self, rhs: T) {
272+
self.0 += rhs.into() as u64;
273+
}
274+
}
275+
259276
impl<T> Mul<T> for ByteSize
260277
where T: Into<u64> {
261278
type Output = ByteSize;

0 commit comments

Comments
 (0)