Error with multiple `update` found

I'm just following the official document to use Sha256.

does anyone knows how to fix it?

Don't post code or error messages as images. Post the full error message.

@alice sorry about the image, here is the full message,

example usage on document:

use hex_literal::hex;
use sha2::{Sha256, Sha512, Digest};

// create a Sha256 object
let mut hasher = Sha256::new();

// write input message
hasher.update(b"hello world");

// read hash digest and consume hasher
let result = hasher.finalize();

my usage and error:

        let mut buffer_read = vec![0u8; PAGE_SIZE - ADD_SIZE];
        let mut hasher = Sha256::new();
        hasher.update(&buffer_read);

   |
59 |         hasher.update(&buffer_read);
   |                ^^^^^^ multiple `update` found

Is that the entire error message?

Usually there's some additional lines of information that include things like an error number. In this case, I'd expect it to also describe the various update methods that it found as well.

@2e71828 I miss some compiler's message, Problem solved with compiler's suggestion :innocent:

But I still confused why this error happen :worried:

error[E0034]: multiple applicable items in scope
  --> lark-security/src/file.rs:77:20
   |
77 |             hasher.update(&buffer_read);
   |                    ^^^^^^ multiple `update` found
   |
   = note: candidate #1 is defined in an impl of the trait `sha2::Digest` for the type `D`
   = note: candidate #2 is defined in an impl of the trait `sha2::digest::DynDigest` for the type `D`
help: disambiguate the associated function for candidate #1
   |
77 |             sha2::Digest::update(&mut hasher, &buffer_read);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #2
   |
77 |             sha2::digest::DynDigest::update(&mut hasher, &buffer_read);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

hasher implements both Digest and DynDigest. Both have an update method. The problem here is that rustc doesn't know which of the two to choose.