Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ArturKovacs/trash
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturKovacs committed Apr 16, 2020
2 parents f63f7ce + 80eba00 commit 1e43dc1
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 267 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Rust

on:
push:
branches: [ master, dev-v2 ]
pull_request:
branches: [ master, dev-v2 ]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust:
- stable
- nightly

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy

- uses: actions-rs/cargo@v1
with:
command: build
args: --verbose
- uses: actions-rs/cargo@v1
with:
command: test
args: --verbose
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
4 changes: 4 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
hard_tabs=true
use_field_init_shorthand=true
use_small_heuristics="Max"
use_try_shorthand=true
40 changes: 20 additions & 20 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ mod platform;
/// Error that might happen during a remove operation.
#[derive(Debug)]
pub enum Error {
Unknown,
Unknown,

/// Error while canonicalizing path.
/// `code` contains a raw os error code if accessible.
CanonicalizePath {
code: Option<i32>,
},
/// Error while canonicalizing path.
/// `code` contains a raw os error code if accessible.
CanonicalizePath {
code: Option<i32>,
},

/// Error while performing the remove operation.
/// `code` contains a raw os error code if accessible.
Remove {
code: Option<i32>,
},
/// Error while performing the remove operation.
/// `code` contains a raw os error code if accessible.
Remove {
code: Option<i32>,
},
}

/// Removes a single file or directory.
///
///
/// # Example
///
///
/// ```
/// extern crate trash;
/// use std::fs::File;
Expand All @@ -46,13 +46,13 @@ pub enum Error {
/// assert!(File::open("remove_me").is_err());
/// ```
pub fn remove<T: AsRef<Path>>(path: T) -> Result<(), Error> {
platform::remove(path)
platform::remove(path)
}

/// Removes all files/directories specified by the collection of paths provided as an argument.
///
///
/// # Example
///
///
/// ```
/// extern crate trash;
/// use std::fs::File;
Expand All @@ -65,13 +65,13 @@ pub fn remove<T: AsRef<Path>>(path: T) -> Result<(), Error> {
/// ```
pub fn remove_all<I, T>(paths: I) -> Result<(), Error>
where
I: IntoIterator<Item = T>,
T: AsRef<Path>,
I: IntoIterator<Item = T>,
T: AsRef<Path>,
{
platform::remove_all(paths)
platform::remove_all(paths)
}

/// Returns true if the functions are implemented on the current platform.
pub fn is_implemented() -> bool {
platform::is_implemented()
platform::is_implemented()
}

0 comments on commit 1e43dc1

Please sign in to comment.