Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example in documentation is out of date #17

Open
wezm opened this issue Jan 5, 2019 · 2 comments
Open

Example in documentation is out of date #17

wezm opened this issue Jan 5, 2019 · 2 comments
Labels
Milestone

Comments

@wezm
Copy link

wezm commented Jan 5, 2019

#11 removed the implementation of Sub for ByteSize as well as the as_usize method. The example in the documentation tries to use both:

https://github.com/hyunsik/bytesize/blob/9d8e13f05fe2fb2596a5534e86ef135af5bae6a3/src/lib.rs#L18

Trying to run this example results in:

error[E0599]: no method named `as_usize` found for type `bytesize::ByteSize` in the current scope
 --> src/main.rs:8:27
  |
8 |   print!("{} bytes", plus.as_usize());
  |                           ^^^^^^^^

error[E0369]: binary operation `-` cannot be applied to type `bytesize::ByteSize`
  --> src/main.rs:10:15
   |
10 |   let minus = ByteSize::tb(100) - ByteSize::gb(4);
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: an implementation of `std::ops::Sub` might be missing for `bytesize::ByteSize`
@wookietreiber
Copy link

Will be fixed in f16ba51 of #15.

@MarcelRobitaille
Copy link

I am still getting the subtraction error. Also, the readme says let minus = ByteSize::tb(100) + ByteSize::gb(4);. Shouldn't this be a -?

@MrCroxx MrCroxx added this to the 2.0 milestone Nov 18, 2024
@MrCroxx MrCroxx added the docs label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants