| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#; |
| 2 | 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/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#; |
| 3 | 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/; |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/::Outputrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Output#; |
| 5 | |
| 6 | #[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:)] |
| 7 | pub struct IptablesErrorrust-analyzer cargo iptables 0.6.0 error/IptablesError# { |
| 8 | pub coderust-analyzer cargo iptables 0.6.0 error/IptablesError#code.: i32, |
| 9 | pub msgrust-analyzer cargo iptables 0.6.0 error/IptablesError#msg.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 10 | } |
| 11 | |
| 12 | 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 IptablesErrorrust-analyzer cargo iptables 0.6.0 error/IptablesError# { |
| 13 | fn fmtrust-analyzer cargo iptables 0.6.0 error/impl#[IptablesError][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# { |
| 14 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "code: {}, msg: {}", self.coderust-analyzer cargo iptables 0.6.0 error/IptablesError#code., self.msgrust-analyzer cargo iptables 0.6.0 error/IptablesError#msg.) |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Outputrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Output#> for IptablesErrorrust-analyzer cargo iptables 0.6.0 error/IptablesError# { |
| 19 | fn fromrust-analyzer cargo iptables 0.6.0 error/impl#[IptablesError][`From<Output>`]from().(output: Outputrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Output#) -> Selfrust-analyzer cargo iptables 0.6.0 error/impl#[IptablesError][`From<Output>`] { |
| 20 | Selfrust-analyzer cargo iptables 0.6.0 error/impl#[IptablesError][`From<Output>`] { |
| 21 | coderust-analyzer cargo iptables 0.6.0 error/IptablesError#code.: output.statusrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Output#status..coderust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[ExitStatus]code().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1), |
| 22 | msgrust-analyzer cargo iptables 0.6.0 error/IptablesError#msg.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8_lossyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8_lossy().(output.stderrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Output#stderr..as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().()).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | impl Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for IptablesErrorrust-analyzer cargo iptables 0.6.0 error/IptablesError# {} |