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 | 46 | /// Writes the encoded tag to `out`. |
| 47 | 47 | pub fn write_to(&self, mut out: impl io::Write) -> io::Result<()> { |
| 48 | 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 | 50 | encode::header_field(b"tag", validated_name(self.name.as_ref())?, &mut out)?; |
| 51 | 51 | if let Some(tagger) = &self.signature { |
| 52 | 52 | encode::trusted_header_signature(b"tagger", tagger, &mut out)?; |
| @@ -87,7 +87,7 @@ impl Kind { · 86 unmodified lines | ||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 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 | 91 | match self { |
| 92 | 92 | Kind::Tree => b"tree", |
| 93 | 93 | Kind::Commit => b"commit", |
| @@ -99,7 +99,7 @@ impl Kind { · 5 unmodified lines | ||
| 99 | 99 | |
| 100 | 100 | impl fmt::Display for Kind { |
| 101 | 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 | |