pub struct Namespace(_);
Expand description
A validated prefix for references to act as a namespace.
Implementations§
source§impl Namespace
impl Namespace
sourcepub fn into_bstring(self) -> BString
pub fn into_bstring(self) -> BString
Dissolve ourselves into the interior representation
sourcepub fn to_path(&self) -> &Path
pub fn to_path(&self) -> &Path
Return ourselves as a path for use within the filesystem.
Examples found in repository?
src/store/file/overlay_iter.rs (line 334)
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
pub fn iter_packed<'s, 'p>(
&'s self,
packed: Option<&'p packed::Buffer>,
) -> std::io::Result<LooseThenPacked<'p, 's>> {
match self.namespace.as_ref() {
Some(namespace) => self.iter_from_info(
IterInfo::PrefixAndBase {
base: self.git_dir(),
prefix: namespace.to_path(),
},
self.common_dir().map(|base| IterInfo::PrefixAndBase {
base,
prefix: namespace.to_path(),
}),
packed,
),
None => self.iter_from_info(
IterInfo::Base { base: self.git_dir() },
self.common_dir().map(|base| IterInfo::Base { base }),
packed,
),
}
}
sourcepub fn into_namespaced_prefix(self, prefix: impl AsRef<Path>) -> PathBuf
pub fn into_namespaced_prefix(self, prefix: impl AsRef<Path>) -> PathBuf
Append the given prefix
to this namespace so it becomes usable for prefixed iteration.
Examples found in repository?
src/store/file/overlay_iter.rs (line 369)
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
pub fn iter_prefixed_packed<'s, 'p>(
&'s self,
prefix: impl AsRef<Path>,
packed: Option<&'p packed::Buffer>,
) -> std::io::Result<LooseThenPacked<'p, 's>> {
match self.namespace.as_ref() {
None => {
let prefix = prefix.as_ref();
let git_dir_info = IterInfo::from_prefix(self.git_dir(), prefix.into())?;
let common_dir_info = self
.common_dir()
.map(|base| IterInfo::from_prefix(base, prefix.into()))
.transpose()?;
self.iter_from_info(git_dir_info, common_dir_info, packed)
}
Some(namespace) => {
let prefix = namespace.to_owned().into_namespaced_prefix(prefix);
let git_dir_info = IterInfo::from_prefix(self.git_dir(), prefix.clone().into())?;
let common_dir_info = self
.common_dir()
.map(|base| IterInfo::from_prefix(base, prefix.into()))
.transpose()?;
self.iter_from_info(git_dir_info, common_dir_info, packed)
}
}
}
Trait Implementations§
source§impl Ord for Namespace
impl Ord for Namespace
source§impl PartialEq<Namespace> for Namespace
impl PartialEq<Namespace> for Namespace
source§impl PartialOrd<Namespace> for Namespace
impl PartialOrd<Namespace> for Namespace
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