Struct sn_api::VersionHash
source · pub struct VersionHash { /* private fields */ }
Expand description
Version Hash corresponding to the entry hash where the content is stored
Implementations§
source§impl VersionHash
impl VersionHash
sourcepub fn entry_hash(&self) -> EntryHash
pub fn entry_hash(&self) -> EntryHash
Getter for the entry hash corresponding to that version
Examples found in repository?
src/app/files/mod.rs (line 565)
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581
async fn append_version_to_files_container(
&self,
current_version: HashSet<VersionHash>,
new_files_map: &FilesMap,
url: &str,
mut safe_url: SafeUrl,
update_nrs: bool,
) -> Result<VersionHash> {
// The FilesContainer is updated by adding an entry containing the link to
// the file with the serialised new version of the FilesMap.
let files_map_xorurl = if !self.dry_run_mode {
self.store_files_map(new_files_map).await?
} else {
"".to_string()
};
// append entry to register
let entry = files_map_xorurl.as_bytes().to_vec();
let replace = current_version.iter().map(|e| e.entry_hash()).collect();
let entry_hash = &self
.register_write(&safe_url.to_string(), entry, replace)
.await?;
let new_version: VersionHash = entry_hash.into();
if update_nrs {
// We need to update the link in the NRS container as well,
// to link it to the new new_version of the FilesContainer we just generated
safe_url.set_content_version(Some(new_version));
let nrs_url = SafeUrl::from_url(url)?;
let top_name = nrs_url.top_name();
let _ = self.nrs_associate(top_name, &safe_url).await?;
}
Ok(new_version)
}
More examples
src/app/resolver/handlers.rs (line 34)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
pub(crate) async fn resolve_nrs_map_container(&self, input_url: SafeUrl) -> Result<SafeData> {
let (target_url, nrs_map) = self
.nrs_get(input_url.public_name(), input_url.content_version())
.await
.map_err(|e| {
warn!("NRS failed to resolve {}: {}", input_url, e);
Error::ContentNotFound(format!("Content not found at {}", input_url))
})?;
if let Some(mut target_url) = target_url {
debug!("NRS Resolved {} => {}", input_url, target_url);
let url_path = input_url.path_decoded()?;
let target_path = target_url.path_decoded()?;
target_url.set_path(&format!("{}{}", target_path, url_path));
let version = input_url.content_version().map(|v| v.entry_hash());
let safe_data = SafeData::NrsEntry {
xorurl: target_url.to_xorurl_string(),
public_name: input_url.public_name().to_string(),
data_type: target_url.data_type(),
resolves_into: target_url,
resolved_from: input_url.to_string(),
version,
};
return Ok(safe_data);
}
debug!("No target associated with input {}", input_url);
debug!("Returning NrsMapContainer with NRS Map.");
let safe_data = SafeData::NrsMapContainer {
xorurl: input_url.to_xorurl_string(),
xorname: input_url.xorname(),
type_tag: input_url.type_tag(),
nrs_map,
data_type: input_url.data_type(),
};
Ok(safe_data)
}
pub(crate) async fn resolve_multimap(
&self,
input_url: SafeUrl,
retrieve_data: bool,
) -> Result<SafeData> {
let data: Multimap = if retrieve_data {
match input_url.content_version() {
None => self.fetch_multimap(&input_url).await?,
Some(v) => vec![(
v.entry_hash(),
self.fetch_multimap_value_by_hash(&input_url, v.entry_hash())
.await?,
)]
.into_iter()
.collect(),
}
} else {
Multimap::new()
};
let safe_data = SafeData::Multimap {
xorurl: input_url.to_xorurl_string(),
xorname: input_url.xorname(),
type_tag: input_url.type_tag(),
data,
resolved_from: input_url.to_string(),
};
Ok(safe_data)
}
pub(crate) async fn resolve_raw(
&self,
input_url: SafeUrl,
metadata: Option<FileInfo>,
retrieve_data: bool,
range: Range,
) -> Result<SafeData> {
ensure_no_subnames(&input_url, "raw data")?;
match input_url.data_type() {
DataType::SafeKey => {
let safe_data = SafeData::SafeKey {
xorurl: input_url.to_xorurl_string(),
xorname: input_url.xorname(),
resolved_from: input_url.to_string(),
};
Ok(safe_data)
}
DataType::File => {
self.retrieve_data(&input_url, retrieve_data, None, &metadata, range)
.await
}
DataType::Register => {
let data = if retrieve_data {
match input_url.content_version() {
None => self.register_fetch_entries(&input_url).await?,
Some(v) => vec![(
v.entry_hash(),
self.register_fetch_entry(&input_url, v.entry_hash())
.await?,
)]
.into_iter()
.collect(),
}
} else {
BTreeSet::new()
};
let safe_data = SafeData::Register {
xorurl: input_url.to_xorurl_string(),
xorname: input_url.xorname(),
type_tag: input_url.type_tag(),
data,
resolved_from: input_url.to_string(),
};
Ok(safe_data)
}
DataType::Spentbook => {
// TODO: perhaps define a new SafeData::Spentbook
let safe_data = SafeData::Register {
xorurl: input_url.to_xorurl_string(),
xorname: input_url.xorname(),
type_tag: input_url.type_tag(),
data: BTreeSet::new(),
resolved_from: input_url.to_string(),
};
Ok(safe_data)
}
}
}
src/app/nrs/mod.rs (line 218)
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
pub async fn nrs_get_subnames_map(
&self,
public_name: &str,
version: Option<VersionHash>,
) -> Result<NrsMap> {
let url = SafeUrl::from_url(&format!("safe://{}", public_name))?;
let mut multimap = match self.fetch_multimap(&url).await {
Ok(s) => Ok(s),
Err(Error::EmptyContent(_)) => Ok(BTreeSet::new()),
Err(Error::ContentNotFound(e)) => Err(Error::ContentNotFound(format!(
"No Nrs Map entry found at {}: {}",
url, e
))),
Err(e) => Err(Error::NetDataError(format!(
"Failed to get Nrs Map entries: {}",
e
))),
}?;
if let Some(version) = version {
if !multimap
.iter()
.any(|(h, _)| VersionHash::from(h) == version)
{
let key_val = self
.fetch_multimap_value_by_hash(&url, version.entry_hash())
.await?;
multimap.insert((version.entry_hash(), key_val));
}
}
// The set may have duplicate entries; the map doesn't.
let subnames_set = convert_multimap_to_nrs_set(&multimap, public_name, version)?;
let nrs_map = get_nrs_map_from_set(&subnames_set)?;
if nrs_map.map.len() != subnames_set.len() {
let diff_set: BTreeSet<(String, SafeUrl)> = nrs_map.map.clone().into_iter().collect();
let conflicting_entries: Vec<(String, SafeUrl)> =
subnames_set.difference(&diff_set).cloned().collect();
return Err(Error::ConflictingNrsEntries(
"Found multiple entries for the same name. This happens when 2 clients write \
concurrently to the same NRS mapping. It can be fixed by associating a new link to \
the conflicting names."
.to_string(),
conflicting_entries,
nrs_map,
));
}
Ok(nrs_map)
}
src/app/register.rs (line 99)
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
pub(crate) async fn register_fetch_entries(
&self,
url: &SafeUrl,
) -> Result<BTreeSet<(EntryHash, Entry)>> {
debug!("Fetching Register entries from {}", url);
let result = match url.content_version() {
Some(v) => {
let hash = v.entry_hash();
debug!("Take entry with version hash: {:?}", hash);
self.register_fetch_entry(url, hash)
.await
.map(|entry| vec![(hash, entry)].into_iter().collect())
}
None => {
debug!("No version so take latest entry from Register at: {}", url);
let address = self.get_register_address(url)?;
let client = self.get_safe_client()?;
match client.read_register(address).await {
Ok(entry) => Ok(entry),
Err(ClientError::NetworkDataError(SafeNdError::NoSuchEntry(_))) => Err(
Error::EmptyContent(format!("Empty Register found at \"{}\"", url)),
),
Err(ClientError::ErrorMsg {
source: ErrorMsg::AccessDenied(_),
..
}) => Err(Error::AccessDenied(format!(
"Couldn't read entry from Register found at \"{}\"",
url
))),
Err(err) => Err(Error::NetDataError(format!(
"Failed to read latest value from Register data: {:?}",
err
))),
}
}
};
match result {
Ok(data) => {
debug!("Register retrieved from {}...", url);
Ok(data)
}
Err(Error::EmptyContent(_)) => Err(Error::EmptyContent(format!(
"Register found at \"{}\" was empty",
url
))),
Err(Error::ContentNotFound(_)) => Err(Error::ContentNotFound(format!(
"No Register found at \"{}\"",
url
))),
other_err => other_err,
}
}
Trait Implementations§
source§impl Clone for VersionHash
impl Clone for VersionHash
source§fn clone(&self) -> VersionHash
fn clone(&self) -> VersionHash
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 VersionHash
impl Debug for VersionHash
source§impl<'de> Deserialize<'de> for VersionHash
impl<'de> Deserialize<'de> for VersionHash
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 Display for VersionHash
impl Display for VersionHash
source§impl From<&EntryHash> for VersionHash
impl From<&EntryHash> for VersionHash
source§impl FromStr for VersionHash
impl FromStr for VersionHash
source§impl Hash for VersionHash
impl Hash for VersionHash
source§impl Ord for VersionHash
impl Ord for VersionHash
source§fn cmp(&self, other: &VersionHash) -> Ordering
fn cmp(&self, other: &VersionHash) -> 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<VersionHash> for VersionHash
impl PartialEq<VersionHash> for VersionHash
source§fn eq(&self, other: &VersionHash) -> bool
fn eq(&self, other: &VersionHash) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<VersionHash> for VersionHash
impl PartialOrd<VersionHash> for VersionHash
source§fn partial_cmp(&self, other: &VersionHash) -> Option<Ordering>
fn partial_cmp(&self, other: &VersionHash) -> 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 moresource§impl Serialize for VersionHash
impl Serialize for VersionHash
impl Copy for VersionHash
impl Eq for VersionHash
impl StructuralEq for VersionHash
impl StructuralPartialEq for VersionHash
Auto Trait Implementations§
impl RefUnwindSafe for VersionHash
impl Send for VersionHash
impl Sync for VersionHash
impl Unpin for VersionHash
impl UnwindSafe for VersionHash
Blanket Implementations§
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
Formats each item in a sequence. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Set the foreground color generically Read more
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Set the background color generically. Read more
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
Change the background color to yellow
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Change the foreground color to magenta
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the background color to magenta
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the background color to purple
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
Change the foreground color to the terminal default
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
Change the background color to the terminal default
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
Change the foreground color to bright black
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
Change the background color to bright black
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
Change the foreground color to bright red
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
Change the background color to bright red
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
Change the foreground color to bright green
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
Change the background color to bright green
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
Change the foreground color to bright yellow
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
Change the background color to bright yellow
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
Change the foreground color to bright blue
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
Change the background color to bright blue
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright magenta
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the background color to bright magenta
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright purple
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the background color to bright purple
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
Change the foreground color to bright cyan
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
Change the background color to bright cyan
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
Change the foreground color to bright white
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
Change the background color to bright white
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
Make the text blink (but fast!)
Hide the text
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
Cross out the text
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the foreground color to a specific RGB value.
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the background color to a specific RGB value.
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Sets the foreground color to an RGB value.
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Sets the background color to an RGB value.
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Immutable access to the
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Immutable access to the
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Mutable access to the
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.