Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow user define a custom value if the file doesn't exist or is empty #97

Closed
asuper0 opened this issue May 6, 2024 · 2 comments
Closed

Comments

@asuper0
Copy link
Contributor

asuper0 commented May 6, 2024

pub fn load_path_or_else<T, F>(
    path: impl AsRef<Path>,
    op: F
) -> Result<T, ConfyError>
where
    T: DeserializeOwned + Serialize,
    F: FnOnce() -> T,
{ }

Add the function so that user can pass a closure, which could return a custom value if the file doesn't exist or is empty.

@asuper0
Copy link
Contributor Author

asuper0 commented May 6, 2024

could solve #85

@deg4uss3r
Copy link
Contributor

closed by #98.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants