Skip to content

Commit 5d39d8a

Browse files
committed
feat: v0.5.1
1 parent 225cc33 commit 5d39d8a

File tree

7 files changed

+4
-12
lines changed

7 files changed

+4
-12
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "file-operation"
3-
version = "0.5.0"
3+
version = "0.5.1"
44
edition = "2024"
55
authors = ["ltpp-universe <[email protected]>"]
66
license = "MIT"
@@ -34,4 +34,4 @@ lto = true
3434
panic = "unwind"
3535
debug = false
3636
codegen-units = 1
37-
strip = "debuginfo"
37+
strip = "debuginfo"

sh/publish.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
cargo publish --allow-dirty;
2+
cargo publish --allow-dirty;

sh/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
cargo test -- --nocapture
2+
cargo test -- --nocapture

src/file/impl.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ use super::r#type::FileDataString;
22
use std::fmt;
33

44
impl From<Vec<u8>> for FileDataString {
5-
#[inline]
65
fn from(bytes: Vec<u8>) -> Self {
76
FileDataString(String::from_utf8(bytes).unwrap_or_else(|_| String::new()))
87
}
98
}
109

1110
impl fmt::Display for FileDataString {
12-
#[inline]
1311
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1412
write!(f, "{}", self.0)
1513
}

src/file/read/async.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use tokio::io::AsyncReadExt;
2424
/// # Notes
2525
/// - The function assumes that the content of the file can be represented as a byte vector (`Vec<u8>`),
2626
/// which is then passed to `T::from` for conversion.
27-
#[inline]
2827
pub async fn async_read_from_file<T>(file_path: &str) -> Result<T, Box<dyn std::error::Error>>
2928
where
3029
T: From<Vec<u8>>,
@@ -54,7 +53,6 @@ where
5453
/// - The function uses `metadata` to retrieve the file's metadata and specifically its size (`metadata.len()`).
5554
/// If the file metadata is not accessible or the file does not exist, the function will return `None`.
5655
/// This is useful when you want to safely handle cases where the file might not be present or readable.
57-
#[inline]
5856
pub async fn async_get_file_size(file_path: &str) -> Option<u64> {
5957
metadata(file_path)
6058
.await

src/file/read/sync.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use std::path::Path;
2424
/// # Notes
2525
/// - The function assumes that the content of the file can be represented as a byte vector (`Vec<u8>`),
2626
/// which is then passed to `T::from` for conversion.
27-
#[inline]
2827
pub fn read_from_file<T>(file_path: &str) -> Result<T, Box<dyn std::error::Error>>
2928
where
3029
T: From<Vec<u8>>,
@@ -54,7 +53,6 @@ where
5453
/// - The function uses `metadata` to retrieve the file's metadata and specifically its size (`metadata.len()`).
5554
/// If the file metadata is not accessible or the file does not exist, the function will return `None`.
5655
/// This is useful when you want to safely handle cases where the file might not be present or readable.
57-
#[inline]
5856
pub fn get_file_size(file_path: &str) -> Option<u64> {
5957
metadata(file_path)
6058
.and_then(|metadata| Ok(Some(metadata.len())))

src/file/write/sync.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use std::io::{Error, Write};
1717
/// - If the file cannot be created or opened for writing, an error will be returned. This can happen if:
1818
/// - There is a problem with the file path (e.g., invalid or inaccessible path).
1919
/// - There are I/O issues when writing to the file.
20-
#[inline]
2120
pub fn write_to_file(file_path: &str, content: &[u8]) -> Result<(), Error> {
2221
if let Some(parent_dir) = std::path::Path::new(file_path).parent() {
2322
create_dir_all(parent_dir)?;
@@ -46,7 +45,6 @@ pub fn write_to_file(file_path: &str, content: &[u8]) -> Result<(), Error> {
4645
/// - If the file cannot be created or opened for writing, an error will be returned. This can happen if:
4746
/// - There is a problem with the file path (e.g., invalid or inaccessible path).
4847
/// - There are I/O issues when writing to the file.
49-
#[inline]
5048
pub fn append_to_file(file_path: &str, content: &[u8]) -> Result<(), Error> {
5149
if let Some(parent_dir) = std::path::Path::new(file_path).parent() {
5250
create_dir_all(parent_dir)?;

0 commit comments

Comments
 (0)