Enum git_protocol::fetch::response::Acknowledgement
source · pub enum Acknowledgement {
Common(ObjectId),
Ready,
Nak,
}
Available on crate features
blocking-client
or async-client
only.Expand description
An ‘ACK’ line received from the server.
Variants§
Common(ObjectId)
The contained id
is in common.
Ready
The server is ready to receive more lines.
Nak
The server isn’t ready yet.
Implementations§
source§impl Acknowledgement
impl Acknowledgement
sourcepub fn from_line(line: &str) -> Result<Acknowledgement, Error>
pub fn from_line(line: &str) -> Result<Acknowledgement, Error>
Parse an Acknowledgement
from a line
as received to the server.
Examples found in repository?
src/fetch/response/mod.rs (line 221)
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
fn parse_v1_ack_or_shallow_or_assume_pack(
acks: &mut Vec<Acknowledgement>,
shallows: &mut Vec<ShallowUpdate>,
peeked_line: &str,
) -> bool {
match Acknowledgement::from_line(peeked_line) {
Ok(ack) => match ack.id() {
Some(id) => {
if !acks.iter().any(|a| a.id() == Some(id)) {
acks.push(ack);
}
}
None => acks.push(ack),
},
Err(_) => match ShallowUpdate::from_line(peeked_line) {
Ok(shallow) => {
shallows.push(shallow);
}
Err(_) => return true,
},
};
false
}
sourcepub fn id(&self) -> Option<&ObjectId>
pub fn id(&self) -> Option<&ObjectId>
Returns the hash of the acknowledged object if this instance acknowledges a common one.
Examples found in repository?
src/fetch/response/mod.rs (line 222)
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
fn parse_v1_ack_or_shallow_or_assume_pack(
acks: &mut Vec<Acknowledgement>,
shallows: &mut Vec<ShallowUpdate>,
peeked_line: &str,
) -> bool {
match Acknowledgement::from_line(peeked_line) {
Ok(ack) => match ack.id() {
Some(id) => {
if !acks.iter().any(|a| a.id() == Some(id)) {
acks.push(ack);
}
}
None => acks.push(ack),
},
Err(_) => match ShallowUpdate::from_line(peeked_line) {
Ok(shallow) => {
shallows.push(shallow);
}
Err(_) => return true,
},
};
false
}
Trait Implementations§
source§impl Clone for Acknowledgement
impl Clone for Acknowledgement
source§fn clone(&self) -> Acknowledgement
fn clone(&self) -> Acknowledgement
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Acknowledgement
impl Debug for Acknowledgement
source§impl<'de> Deserialize<'de> for Acknowledgement
impl<'de> Deserialize<'de> for Acknowledgement
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Hash for Acknowledgement
impl Hash for Acknowledgement
source§impl Ord for Acknowledgement
impl Ord for Acknowledgement
source§fn cmp(&self, other: &Acknowledgement) -> Ordering
fn cmp(&self, other: &Acknowledgement) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<Acknowledgement> for Acknowledgement
impl PartialEq<Acknowledgement> for Acknowledgement
source§fn eq(&self, other: &Acknowledgement) -> bool
fn eq(&self, other: &Acknowledgement) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<Acknowledgement> for Acknowledgement
impl PartialOrd<Acknowledgement> for Acknowledgement
source§fn partial_cmp(&self, other: &Acknowledgement) -> Option<Ordering>
fn partial_cmp(&self, other: &Acknowledgement) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more