| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/; |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/; |
| 5 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::{Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#}; |
| 6 | |
| 7 | use superrust-analyzer cargo buffered-reader 1.4.1 crate/::*; |
| 8 | use craterust-analyzer cargo buffered-reader 1.4.1 crate/::file_errorrust-analyzer cargo buffered-reader 1.4.1 file_error/::FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#; |
| 9 | |
| 10 | /// Wraps files. |
| 11 | /// |
| 12 | /// This is a generic implementation that may be replaced by |
| 13 | /// platform-specific versions. |
| 14 | pub struct Filerust-analyzer cargo buffered-reader 1.4.1 file_generic/File#<'a, C: fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>(Genericrust-analyzer cargo buffered-reader 1.4.1 generic/Generic#<fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#, C>, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#, PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<&'a ()>); |
| 15 | |
| 16 | assert_send_and_syncrust-analyzer cargo buffered-reader 1.4.1 macros/assert_send_and_sync!!(Filerust-analyzer cargo buffered-reader 1.4.1 file_generic/File#<'_, C> |
| 17 | where C: fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#); |
| 18 | |
| 19 | impl<'a, C: fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#> 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 Filerust-analyzer cargo buffered-reader 1.4.1 file_generic/File#<'a, C> { |
| 20 | fn fmtrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][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# { |
| 21 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "File {:?}", self.1rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#1..displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().()) |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | impl<'a, C: fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Filerust-analyzer cargo buffered-reader 1.4.1 file_generic/File#<'a, C> { |
| 26 | fn fmtrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][Debug]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 | f.debug_tuplerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]debug_tuple().("File") |
| 28 | .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugTuple<'a, 'b>`]field().(&self.0rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#0.) |
| 29 | .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugTuple<'a, 'b>`]field().(&self.1rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#1.) |
| 30 | .finishrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugTuple<'a, 'b>`]finish().() |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | impl<'a> Filerust-analyzer cargo buffered-reader 1.4.1 file_generic/File#<'a, ()> { |
| 35 | /// Wraps a [`fs::File`]. |
| 36 | /// |
| 37 | /// The given `path` should be the path that has been used to |
| 38 | /// obtain `file` from. It is used in error messages to provide |
| 39 | /// context to the user. |
| 40 | /// |
| 41 | /// While this is slightly less convenient than [`Self::open`], it |
| 42 | /// allows one to inspect or manipulate the [`fs::File`] object |
| 43 | /// before handing it off. For example, one can inspect the |
| 44 | /// metadata. |
| 45 | pub fn newrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, ()>`]new().<P: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>>(file: fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#, path: P) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, ()>`]> { |
| 46 | Selfrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, ()>`]::new_with_cookierust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`]new_with_cookie().(file, path.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(), ()) |
| 47 | } |
| 48 | |
| 49 | /// Opens the given file. |
| 50 | pub fn openrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, ()>`]open().<P: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>>(path: P) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, ()>`]> { |
| 51 | Selfrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, ()>`]::with_cookierust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`]with_cookie().(path, ()) |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | impl<'a, C: fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#> Filerust-analyzer cargo buffered-reader 1.4.1 file_generic/File#<'a, C> { |
| 56 | /// Like [`Self::new`], but sets a cookie. |
| 57 | /// |
| 58 | /// The given `path` should be the path that has been used to |
| 59 | /// obtain `file` from. It is used in error messages to provide |
| 60 | /// context to the user. |
| 61 | /// |
| 62 | /// While this is slightly less convenient than |
| 63 | /// [`Self::with_cookie`], it allows one to inspect or manipulate |
| 64 | /// the [`fs::File`] object before handing it off. For example, |
| 65 | /// one can inspect the metadata. |
| 66 | pub fn new_with_cookierust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`]new_with_cookie().<P: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>>(file: fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#, path: P, cookie: C) |
| 67 | -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`]> { |
| 68 | let path = path.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(); |
| 69 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Filerust-analyzer cargo buffered-reader 1.4.1 file_generic/File#(Genericrust-analyzer cargo buffered-reader 1.4.1 generic/Generic#::with_cookierust-analyzer cargo buffered-reader 1.4.1 generic/impl#[`Generic<T, C>`]with_cookie().(file, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, cookie), path.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#)) |
| 70 | } |
| 71 | |
| 72 | /// Like [`Self::open`], but sets a cookie. |
| 73 | pub fn with_cookierust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`]with_cookie().<P: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>>(path: P, cookie: C) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`]> { |
| 74 | let path = path.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(); |
| 75 | let file = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(path).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#::newrust-analyzer cargo buffered-reader 1.4.1 file_error/impl#[FileError]new().(path, e))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 76 | Selfrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`]::new_with_cookierust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`]new_with_cookie().(file, path, cookie) |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | impl<'a, C: fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read# for Filerust-analyzer cargo buffered-reader 1.4.1 file_generic/File#<'a, C> { |
| 81 | fn readrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][Read]read().(&mut self, buf: &mut [u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> { |
| 82 | self.0rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#0..readrust-analyzer cargo buffered-reader 1.4.1 generic/impl#[`Generic<T, C>`][Read]read().(buf) |
| 83 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#::newrust-analyzer cargo buffered-reader 1.4.1 file_error/impl#[FileError]new().(&self.1rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#1., e)) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | impl<'a, C: fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#> BufferedReaderrust-analyzer cargo buffered-reader 1.4.1 BufferedReader#<C> for Filerust-analyzer cargo buffered-reader 1.4.1 file_generic/File#<'a, C> { |
| 88 | fn bufferrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]buffer().(&self) -> &[u8] { |
| 89 | self.0rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#0..bufferrust-analyzer cargo buffered-reader 1.4.1 generic/impl#[`Generic<T, C>`][`BufferedReader<C>`]buffer().() |
| 90 | } |
| 91 | |
| 92 | fn datarust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]data().(&mut self, amount: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<&[u8]> { |
| 93 | let path = &self.1rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#1.; |
| 94 | self.0rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#0..datarust-analyzer cargo buffered-reader 1.4.1 generic/impl#[`Generic<T, C>`][`BufferedReader<C>`]data().(amount) |
| 95 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#::newrust-analyzer cargo buffered-reader 1.4.1 file_error/impl#[FileError]new().(path, e)) |
| 96 | } |
| 97 | |
| 98 | fn data_hardrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]data_hard().(&mut self, amount: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<&[u8]> { |
| 99 | let path = &self.1rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#1.; |
| 100 | self.0rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#0..data_hardrust-analyzer cargo buffered-reader 1.4.1 generic/impl#[`Generic<T, C>`][`BufferedReader<C>`]data_hard().(amount) |
| 101 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#::newrust-analyzer cargo buffered-reader 1.4.1 file_error/impl#[FileError]new().(path, e)) |
| 102 | } |
| 103 | |
| 104 | fn consumerust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]consume().(&mut self, amount: usize) -> &[u8] { |
| 105 | self.0rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#0..consumerust-analyzer cargo buffered-reader 1.4.1 generic/impl#[`Generic<T, C>`][`BufferedReader<C>`]consume().(amount) |
| 106 | } |
| 107 | |
| 108 | fn data_consumerust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]data_consume().(&mut self, amount: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<&[u8]> { |
| 109 | let path = &self.1rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#1.; |
| 110 | self.0rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#0..data_consumerust-analyzer cargo buffered-reader 1.4.1 generic/impl#[`Generic<T, C>`][`BufferedReader<C>`]data_consume().(amount) |
| 111 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#::newrust-analyzer cargo buffered-reader 1.4.1 file_error/impl#[FileError]new().(path, e)) |
| 112 | } |
| 113 | |
| 114 | fn data_consume_hardrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]data_consume_hard().(&mut self, amount: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<&[u8]> { |
| 115 | let path = &self.1rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#1.; |
| 116 | self.0rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#0..data_consume_hardrust-analyzer cargo buffered-reader 1.4.1 generic/impl#[`Generic<T, C>`][`BufferedReader<C>`]data_consume_hard().(amount) |
| 117 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#::newrust-analyzer cargo buffered-reader 1.4.1 file_error/impl#[FileError]new().(path, e)) |
| 118 | } |
| 119 | |
| 120 | fn get_mutrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]get_mut().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&mut dyn BufferedReaderrust-analyzer cargo buffered-reader 1.4.1 BufferedReader#<C>> { |
| 121 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 122 | } |
| 123 | |
| 124 | fn get_refrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]get_ref().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&dyn BufferedReaderrust-analyzer cargo buffered-reader 1.4.1 BufferedReader#<C>> { |
| 125 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 126 | } |
| 127 | |
| 128 | fn into_innerrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]into_inner().<'b>(self: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<Selfrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]>) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn BufferedReaderrust-analyzer cargo buffered-reader 1.4.1 BufferedReader#<C> + 'b>> |
| 129 | where Selfrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]: 'b { |
| 130 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 131 | } |
| 132 | |
| 133 | fn cookie_setrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]cookie_set().(&mut self, cookie: C) -> C { |
| 134 | self.0rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#0..cookie_setrust-analyzer cargo buffered-reader 1.4.1 generic/impl#[`Generic<T, C>`][`BufferedReader<C>`]cookie_set().(cookie) |
| 135 | } |
| 136 | |
| 137 | fn cookie_refrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]cookie_ref().(&self) -> &C { |
| 138 | self.0rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#0..cookie_refrust-analyzer cargo buffered-reader 1.4.1 generic/impl#[`Generic<T, C>`][`BufferedReader<C>`]cookie_ref().() |
| 139 | } |
| 140 | |
| 141 | fn cookie_mutrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, C>`][`BufferedReader<C>`]cookie_mut().(&mut self) -> &mut C { |
| 142 | self.0rust-analyzer cargo buffered-reader 1.4.1 file_generic/File#0..cookie_mutrust-analyzer cargo buffered-reader 1.4.1 generic/impl#[`Generic<T, C>`][`BufferedReader<C>`]cookie_mut().() |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | #[cfg(test)] |
| 147 | mod testrust-analyzer cargo buffered-reader 1.4.1 file_generic/test/ { |
| 148 | use superrust-analyzer cargo buffered-reader 1.4.1 file_generic/::*; |
| 149 | |
| 150 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 151 | fn error_contains_pathrust-analyzer cargo buffered-reader 1.4.1 file_generic/test/error_contains_path().() { |
| 152 | let p = "/i/do/not/exist"; |
| 153 | let e = Filerust-analyzer cargo buffered-reader 1.4.1 file_generic/File#::openrust-analyzer cargo buffered-reader 1.4.1 file_generic/impl#[`File<'a, ()>`]open().(p).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 154 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(e.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().().containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(p)); |
| 155 | } |
| 156 | } |