Skip to content

Commit

Permalink
Relax bounds for AsRef<Path>.
Browse files Browse the repository at this point in the history
  • Loading branch information
jneem authored and bilelmoussaoui committed Mar 9, 2022
1 parent 2e1d39f commit 17c92d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/desktop/file_chooser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl SaveFileOptions {

/// Sets the current folder.
#[must_use]
pub fn current_folder(mut self, current_folder: impl AsRef<Path> + Type + Serialize) -> Self {
pub fn current_folder(mut self, current_folder: impl AsRef<Path>) -> Self {
let cstr = CString::new(current_folder.as_ref().as_os_str().as_bytes())
.expect("`current_folder` should not be null terminated");
self.current_folder = Some(cstr.into_bytes_with_nul());
Expand All @@ -314,7 +314,7 @@ impl SaveFileOptions {

/// Sets the absolute path of the file.
#[must_use]
pub fn current_file(mut self, current_file: impl AsRef<Path> + Type + Serialize) -> Self {
pub fn current_file(mut self, current_file: impl AsRef<Path>) -> Self {
let cstr = CString::new(current_file.as_ref().as_os_str().as_bytes())
.expect("`current_file` should not be null terminated");
self.current_file = Some(cstr.into_bytes_with_nul());
Expand Down Expand Up @@ -392,7 +392,7 @@ impl SaveFilesOptions {

/// Specifies the current folder path.
#[must_use]
pub fn current_folder(mut self, current_folder: impl AsRef<Path> + Type + Serialize) -> Self {
pub fn current_folder(mut self, current_folder: impl AsRef<Path>) -> Self {
let cstr = CString::new(current_folder.as_ref().as_os_str().as_bytes())
.expect("`current_folder` should not be null terminated");
self.current_folder = Some(cstr.into_bytes_with_nul());
Expand All @@ -401,7 +401,7 @@ impl SaveFilesOptions {

/// Sets a list of files to save.
#[must_use]
pub fn files(mut self, files: &[impl AsRef<Path> + Type + Serialize]) -> Self {
pub fn files(mut self, files: &[impl AsRef<Path>]) -> Self {
self.files = Some(
files
.iter()
Expand Down
6 changes: 3 additions & 3 deletions src/documents/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ impl<'a> DocumentsProxy<'a> {
pub async fn add_named(
&self,
o_path_parent_fd: &(impl AsRawFd + fmt::Debug),
filename: (impl AsRef<Path> + Serialize + Type + fmt::Debug),
filename: impl AsRef<Path>,
reuse_existing: bool,
persistent: bool,
) -> Result<OwnedDocumentID, Error> {
Expand Down Expand Up @@ -343,7 +343,7 @@ impl<'a> DocumentsProxy<'a> {
pub async fn add_named_full(
&self,
o_path_fd: &(impl AsRawFd + fmt::Debug),
filename: (impl AsRef<Path> + Serialize + Type + fmt::Debug),
filename: impl AsRef<Path>,
flags: BitFlags<Flags>,
app_id: ApplicationID<'_>,
permissions: &[Permission],
Expand Down Expand Up @@ -501,7 +501,7 @@ impl<'a> DocumentsProxy<'a> {
#[doc(alias = "Lookup")]
pub async fn lookup(
&self,
filename: (impl AsRef<Path> + Serialize + Type + fmt::Debug),
filename: impl AsRef<Path>,
) -> Result<Option<OwnedDocumentID>, Error> {
let cstr = CString::new(filename.as_ref().as_os_str().as_bytes())
.expect("`filename` should not be null terminated");
Expand Down
4 changes: 2 additions & 2 deletions src/flatpak/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ impl<'a> FlatpakProxy<'a> {
#[doc(alias = "xdp_portal_spawn")]
pub async fn spawn(
&self,
cwd_path: (impl AsRef<Path> + Type + Serialize + Debug),
argv: &[impl AsRef<Path> + Type + Serialize + Debug],
cwd_path: impl AsRef<Path>,
argv: &[impl AsRef<Path>],
fds: HashMap<u32, Fd>,
envs: HashMap<&str, &str>,
flags: BitFlags<SpawnFlags>,
Expand Down

0 comments on commit 17c92d1

Please sign in to comment.