| 1 | use bstrrust-analyzer cargo bstr 1.12.1 crate/::BStrrust-analyzer cargo bstr 1.12.1 bstr/BStr#; |
| 2 | |
| 3 | use craterust-analyzer cargo gix-credentials 0.38.0 crate/::protocolrust-analyzer cargo gix-credentials 0.38.0 protocol/::contextrust-analyzer cargo gix-credentials 0.38.0 protocol/context/::Errorrust-analyzer cargo gix-credentials 0.38.0 protocol/context/Error#; |
| 4 | |
| 5 | mod writerust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/write/ { |
| 6 | use bstrrust-analyzer cargo bstr 1.12.1 crate/::{BStrrust-analyzer cargo bstr 1.12.1 bstr/BStr#, BStringrust-analyzer cargo bstr 1.12.1 bstring/BString#}; |
| 7 | |
| 8 | use craterust-analyzer cargo gix-credentials 0.38.0 crate/::protocolrust-analyzer cargo gix-credentials 0.38.0 protocol/::{contextrust-analyzer cargo gix-credentials 0.38.0 protocol/context/::serderust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/::validaterust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/validate()., Contextrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#}; |
| 9 | |
| 10 | impl Contextrust-analyzer cargo gix-credentials 0.38.0 protocol/Context# { |
| 11 | /// Write ourselves to `out` such that [`from_bytes()`][Self::from_bytes()] can decode it losslessly. |
| 12 | pub fn write_torust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/write/impl#[Context]write_to().(&self, mut out: impl 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/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#) -> 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/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 13 | use bstrrust-analyzer cargo bstr 1.12.1 crate/::ByteSlicerust-analyzer cargo bstr 1.12.1 ext_slice/ByteSlice#; |
| 14 | fn write_keyrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/write/write_key().(out: &mut impl 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/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#, key: &str, value: &BStrrust-analyzer cargo bstr 1.12.1 bstr/BStr#) -> 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/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 15 | out.write_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#write_all().(key.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 16 | out.write_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#write_all().(b"=")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 17 | out.write_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#write_all().(value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 18 | out.write_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#write_all().(b"\n") |
| 19 | } |
| 20 | let Contextrust-analyzer cargo gix-credentials 0.38.0 protocol/Context# { |
| 21 | protocolrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#protocol., |
| 22 | hostrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#host., |
| 23 | pathrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#path., |
| 24 | usernamerust-analyzer cargo gix-credentials 0.38.0 protocol/Context#username., |
| 25 | passwordrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#password., |
| 26 | oauth_refresh_tokenrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#oauth_refresh_token., |
| 27 | password_expiry_utcrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#password_expiry_utc., |
| 28 | urlrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#url., |
| 29 | // We only decode quit and interpret it, but won't get to pass it on as it means to stop the |
| 30 | // credential helper invocation chain. |
| 31 | quitrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#quit.: _, |
| 32 | } = self; |
| 33 | for (key, value) in [("url", url), ("path", path)] { |
| 34 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value) = value { |
| 35 | validaterust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/validate().(key, value.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().()).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(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/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::otherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]other().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 36 | write_keyrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/write/write_key().(&mut out, key, value.as_refrust-analyzer cargo bstr 1.12.1 impls/bstring/impl#[BString][`AsRef<BStr>`]as_ref().()).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(); |
| 37 | } |
| 38 | } |
| 39 | for (key, value) in [ |
| 40 | ("protocol", protocol), |
| 41 | ("host", host), |
| 42 | ("username", username), |
| 43 | ("password", password), |
| 44 | ("oauth_refresh_token", oauth_refresh_token), |
| 45 | ] { |
| 46 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value) = value { |
| 47 | validaterust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/validate().(key, value.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(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/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::otherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]other().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 48 | write_keyrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/write/write_key().(&mut out, key, value.as_bytesrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_bytes().().as_bstrrust-analyzer cargo bstr 1.12.1 ext_slice/ByteSlice#as_bstr().()).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(); |
| 49 | } |
| 50 | } |
| 51 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value) = password_expiry_utc { |
| 52 | let key = "password_expiry_utc"; |
| 53 | let value = value.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 54 | validaterust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/validate().(key, value.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(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/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::otherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]other().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 55 | write_keyrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/write/write_key().(&mut out, key, value.as_bytesrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_bytes().().as_bstrrust-analyzer cargo bstr 1.12.1 ext_slice/ByteSlice#as_bstr().()).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(); |
| 56 | } |
| 57 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 58 | } |
| 59 | |
| 60 | /// Like [`write_to()`][Self::write_to()], but writes infallibly into memory. |
| 61 | pub fn to_bstringrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/write/impl#[Context]to_bstring().(&self) -> BStringrust-analyzer cargo bstr 1.12.1 bstring/BString# { |
| 62 | let mut buf = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::<u8>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 63 | self.write_torust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/write/impl#[Context]write_to().(&mut buf).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("infallible"); |
| 64 | buf.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /// |
| 70 | pub mod decoderust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/ { |
| 71 | use bstrrust-analyzer cargo bstr 1.12.1 crate/::{BStringrust-analyzer cargo bstr 1.12.1 bstring/BString#, ByteSlicerust-analyzer cargo bstr 1.12.1 ext_slice/ByteSlice#}; |
| 72 | |
| 73 | use craterust-analyzer cargo gix-credentials 0.38.0 crate/::protocolrust-analyzer cargo gix-credentials 0.38.0 protocol/::{contextrust-analyzer cargo gix-credentials 0.38.0 protocol/context/, contextrust-analyzer cargo gix-credentials 0.38.0 protocol/context/::serderust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/::validaterust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/validate()., Contextrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#}; |
| 74 | |
| 75 | /// The error returned by [`from_bytes()`][Context::from_bytes()]. |
| 76 | #[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:, thiserrorrust-analyzer cargo thiserror 2.0.18 crate/::Errorrust-analyzer cargo thiserror-impl 2.0.18 Error:)] |
| 77 | #[allow(missing_docs)] |
| 78 | pub enum Errorrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error# { |
| 79 | #[errorrust-analyzer cargo thiserror-impl 2.0.18 error:("Illformed UTF-8 in value of key {key:?}: {value:?}")] |
| 80 | IllformedUtf8InValuerust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#IllformedUtf8InValue# { keyrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#IllformedUtf8InValue#key.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, valuerust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#IllformedUtf8InValue#value.: BStringrust-analyzer cargo bstr 1.12.1 bstring/BString# }, |
| 81 | #[errorrust-analyzer cargo thiserror-impl 2.0.18 error:(transparent)] |
| 82 | Encodingrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#Encoding#(#[from] contextrust-analyzer cargo gix-credentials 0.38.0 protocol/context/::Errorrust-analyzer cargo gix-credentials 0.38.0 protocol/context/Error#), |
| 83 | #[errorrust-analyzer cargo thiserror-impl 2.0.18 error:("Invalid format in line {line:?}, expecting key=value")] |
| 84 | Syntaxrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#Syntax# { linerust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#Syntax#line.: BStringrust-analyzer cargo bstr 1.12.1 bstring/BString# }, |
| 85 | } |
| 86 | |
| 87 | impl Contextrust-analyzer cargo gix-credentials 0.38.0 protocol/Context# { |
| 88 | /// Decode ourselves from `input` which is the format written by [`write_to()`][Self::write_to()]. |
| 89 | pub fn from_bytesrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/impl#[Context]from_bytes().(input: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/impl#[Context], Errorrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#> { |
| 90 | let mut ctx = Contextrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#::defaultrust-analyzer cargo gix-credentials 0.38.0 protocol/impl#[Context][Default]default().(); |
| 91 | let Contextrust-analyzer cargo gix-credentials 0.38.0 protocol/Context# { |
| 92 | protocolrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#protocol., |
| 93 | hostrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#host., |
| 94 | pathrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#path., |
| 95 | usernamerust-analyzer cargo gix-credentials 0.38.0 protocol/Context#username., |
| 96 | passwordrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#password., |
| 97 | oauth_refresh_tokenrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#oauth_refresh_token., |
| 98 | password_expiry_utcrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#password_expiry_utc., |
| 99 | urlrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#url., |
| 100 | quitrust-analyzer cargo gix-credentials 0.38.0 protocol/Context#quit., |
| 101 | } = &mut ctx; |
| 102 | for res in input.linesrust-analyzer cargo bstr 1.12.1 ext_slice/ByteSlice#lines().().take_whilerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take_while().(|line| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().line.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().()).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|line| { |
| 103 | let mut it = line.splitnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]splitn().(2, |b| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'='); |
| 104 | match ( |
| 105 | it.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`SplitN<'a, T, P>`][Iterator]next().().and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|k| k.to_strrust-analyzer cargo bstr 1.12.1 ext_slice/ByteSlice#to_str().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()), |
| 106 | it.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`SplitN<'a, T, P>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(ByteSlicerust-analyzer cargo bstr 1.12.1 ext_slice/ByteSlice#::as_bstrrust-analyzer cargo bstr 1.12.1 ext_slice/ByteSlice#as_bstr().), |
| 107 | ) { |
| 108 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(key), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value)) => validaterust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/validate().(key, value) |
| 109 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| (key, value.to_ownedrust-analyzer cargo bstr 1.12.1 impls/bstring/impl#[BStr][ToOwned]to_owned().())) |
| 110 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().), |
| 111 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#::Syntaxrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#Syntax# { linerust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#Syntax#line.: line.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() }), |
| 112 | } |
| 113 | }) { |
| 114 | let (key, value) = res?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 115 | match key { |
| 116 | "protocol" | "host" | "username" | "password" | "oauth_refresh_token" => { |
| 117 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().value.is_utf8rust-analyzer cargo bstr 1.12.1 ext_slice/ByteSlice#is_utf8().() { |
| 118 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#::IllformedUtf8InValuerust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#IllformedUtf8InValue# { keyrust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#IllformedUtf8InValue#key.: key.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), valuerust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/decode/Error#IllformedUtf8InValue#value. }); |
| 119 | } |
| 120 | let value = value.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 121 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().match key { |
| 122 | "protocol" => &mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().protocol, |
| 123 | "host" => host, |
| 124 | "username" => username, |
| 125 | "password" => password, |
| 126 | "oauth_refresh_token" => oauth_refresh_token, |
| 127 | _ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!("checked field names in match above"), |
| 128 | } = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value); |
| 129 | } |
| 130 | "password_expiry_utc" => { |
| 131 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().password_expiry_utc = value.to_strrust-analyzer cargo bstr 1.12.1 ext_slice/ByteSlice#to_str().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|value| value.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()); |
| 132 | } |
| 133 | "url" => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().url = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value), |
| 134 | "path" => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().path = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value), |
| 135 | "quit" => { |
| 136 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().quit = gix_config_valuerust-analyzer cargo gix-config-value 0.18.0 crate/::Booleanrust-analyzer cargo gix-config-value 0.18.0 types/Boolean#::try_fromrust-analyzer cargo gix-config-value 0.18.0 boolean/impl#[Boolean][`TryFrom<&BStr>`]try_from().(value.as_refrust-analyzer cargo bstr 1.12.1 impls/bstring/impl#[BString][`AsRef<BStr>`]as_ref().()).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().); |
| 137 | } |
| 138 | _ => {} |
| 139 | } |
| 140 | } |
| 141 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ctx) |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | fn validaterust-analyzer cargo gix-credentials 0.38.0 protocol/context/serde/validate().(key: &str, value: &BStrrust-analyzer cargo bstr 1.12.1 bstr/BStr#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo gix-credentials 0.38.0 protocol/context/Error#> { |
| 147 | if key.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().('\0') || key.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().('\n') || value.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&0) || value.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&b'\n') { |
| 148 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo gix-credentials 0.38.0 protocol/context/Error#::Encodingrust-analyzer cargo gix-credentials 0.38.0 protocol/context/Error#Encoding# { |
| 149 | keyrust-analyzer cargo gix-credentials 0.38.0 protocol/context/Error#Encoding#key.: key.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), |
| 150 | valuerust-analyzer cargo gix-credentials 0.38.0 protocol/context/Error#Encoding#value.: value.to_ownedrust-analyzer cargo bstr 1.12.1 impls/bstring/impl#[BStr][ToOwned]to_owned().(), |
| 151 | }); |
| 152 | } |
| 153 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 154 | } |