mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Workaround for Rust versions below 1.91.0
This commit is contained in:
parent
27170ce70b
commit
c91628484e
2 changed files with 11 additions and 5 deletions
|
|
@ -84,7 +84,9 @@ impl LocBuf {
|
|||
Ok(Self { inner: loc.inner, uri, urn })
|
||||
}
|
||||
|
||||
pub const fn empty() -> Self { Self { inner: PathBuf::new(), uri: 0, urn: 0 } }
|
||||
// FIXME: use `LocBuf::empty()` when Rust 1.91.0 released
|
||||
// pub const fn empty() -> Self { Self { inner: PathBuf::new(), uri: 0, urn: 0 }
|
||||
// }
|
||||
|
||||
pub fn zeroed(path: impl Into<PathBuf>) -> Self {
|
||||
let loc = Self::from(path.into());
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use std::{borrow::Cow, ffi::OsStr, fmt::{Debug, Formatter}, hash::BuildHasher, path::{Path, PathBuf}, str::FromStr};
|
||||
use std::{borrow::Cow, ffi::OsStr, fmt::{Debug, Formatter}, hash::BuildHasher, path::{Path, PathBuf}, str::FromStr, sync::OnceLock};
|
||||
|
||||
use anyhow::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
|
@ -80,9 +80,13 @@ impl PartialEq<Url<'_>> for &UrlBuf {
|
|||
|
||||
impl UrlBuf {
|
||||
#[inline]
|
||||
pub const fn new() -> &'static Self {
|
||||
static U: UrlBuf = UrlBuf { loc: LocBuf::empty(), scheme: Scheme::Regular };
|
||||
&U
|
||||
pub fn new() -> &'static Self {
|
||||
static U: OnceLock<UrlBuf> = OnceLock::new();
|
||||
U.get_or_init(Self::default)
|
||||
|
||||
// FIXME: use `LocBuf::empty()` when Rust 1.91.0 released
|
||||
// static U: UrlBuf = UrlBuf { loc: LocBuf::empty(), scheme: Scheme::Regular
|
||||
// }; &U
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue