Showing the changes to git-object/src (2 of 20 files). Show all
Unified · Split
| @@ -46,7 +46,7 @@ impl Tag { · 45 unmodified lines | |||
| 46 | /// Writes the encoded tag to `out`. | 46 | /// Writes the encoded tag to `out`. |
| 47 | pub fn write_to(&self, mut out: impl io::Write) -> io::Result<()> { | 47 | pub fn write_to(&self, mut out: impl io::Write) -> io::Result<()> { |
| 48 | encode::trusted_header_id(b"object", &self.target, &mut out)?; | 48 | encode::trusted_header_id(b"object", &self.target, &mut out)?; |
| 49 | encode::trusted_header_field(b"type", self.target_kind.to_bytes(), &mut out)?; | 49 | encode::trusted_header_field(b"type", self.target_kind.as_bytes(), &mut out)?; |
| 50 | encode::header_field(b"tag", validated_name(self.name.as_ref())?, &mut out)?; | 50 | encode::header_field(b"tag", validated_name(self.name.as_ref())?, &mut out)?; |
| 51 | if let Some(tagger) = &self.signature { | 51 | if let Some(tagger) = &self.signature { |
| 52 | encode::trusted_header_signature(b"tagger", tagger, &mut out)?; | 52 | encode::trusted_header_signature(b"tagger", tagger, &mut out)?; |
| @@ -87,7 +87,7 @@ impl Kind { · 86 unmodified lines | |||
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | /// Return the name of `self` for use in serialized loose git objects. | 89 | /// Return the name of `self` for use in serialized loose git objects. |
| 90 | pub fn to_bytes(&self) -> &[u8] { | 90 | pub fn as_bytes(&self) -> &[u8] { |
| 91 | match self { | 91 | match self { |
| 92 | Kind::Tree => b"tree", | 92 | Kind::Tree => b"tree", |
| 93 | Kind::Commit => b"commit", | 93 | Kind::Commit => b"commit", |
| @@ -99,7 +99,7 @@ impl Kind { · 5 unmodified lines | |||
| 99 | 99 | ||
| 100 | impl fmt::Display for Kind { | 100 | impl fmt::Display for Kind { |
| 101 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | 101 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 102 | f.write_str(std::str::from_utf8(self.to_bytes()).expect("Converting Kind name to utf8")) | 102 | f.write_str(std::str::from_utf8(self.as_bytes()).expect("Converting Kind name to utf8")) |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| 105 | 105 | ||