Debian Codegraph @

src/errors.rs

raw symbols SCIP
1 // Copyright (c) 2018 the linkerd2-proxy authors
2 // Copyright (c) The buf-list Contributors
3 // SPDX-License-Identifier: Apache-2.0
4
5 //! Error types returned by buf-list.
6
7 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/, fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/};
8
9 /// An error returned if `read_exact` was called on a [`Cursor`](crate::Cursor) that doesn't have
10 /// enough bytes remaining.
11 ///
12 /// This is private because `read_exact_impl` returns an `io::Error`.
13 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
14 pub(craterust-analyzer cargo buf-list 1.1.2 crate/) struct ReadExactErrorrust-analyzer cargo buf-list 1.1.2 errors/ReadExactError# {
15 pub(craterust-analyzer cargo buf-list 1.1.2 crate/) remainingrust-analyzer cargo buf-list 1.1.2 errors/ReadExactError#remaining.: u64,
16 pub(craterust-analyzer cargo buf-list 1.1.2 crate/) buf_lenrust-analyzer cargo buf-list 1.1.2 errors/ReadExactError#buf_len.: usize,
17 }
18
19 impl errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for ReadExactErrorrust-analyzer cargo buf-list 1.1.2 errors/ReadExactError# {
20 fn sourcerust-analyzer cargo buf-list 1.1.2 errors/impl#[ReadExactError][Error]source().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&(dyn errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + 'static)> {
21 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
22 }
23 }
24
25 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for ReadExactErrorrust-analyzer cargo buf-list 1.1.2 errors/ReadExactError# {
26 fn fmtrust-analyzer cargo buf-list 1.1.2 errors/impl#[ReadExactError][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
27 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(
28 f,
29 "Cursor had {} bytes remaining but buffer was {} bytes long",
30 self.remainingrust-analyzer cargo buf-list 1.1.2 errors/ReadExactError#remaining., self.buf_lenrust-analyzer cargo buf-list 1.1.2 errors/ReadExactError#buf_len.
31 )
32 }
33 }