GithubHelp home page GithubHelp logo

Compatibility with async_std? about cluflock HOT 2 CLOSED

vlovich avatar vlovich commented on June 30, 2024
Compatibility with async_std?

from cluflock.

Comments (2)

denisandroid avatar denisandroid commented on June 30, 2024

This api is completely universal, and implementing your own File versions is easy.

The only thing is that there will be a different description for Windows.

For example linux:

impl FlockElement for async_std::fs::File {
	type FilePtr = async_std::os::unix::io::RawFd;

	#[inline(always)]
	fn as_file_ptr(&self) -> Self::FilePtr {
		async_std::os::unix::io::AsRawFd::as_raw_fd(self)
	}
}

Why is it so easy?

AsRawFd trait for async file is PRESENT (>>> https://docs.rs/async-std/1.7.0/async_std/fs/struct.File.html#impl-AsRawFd)

source 0: https://docs.rs/async-std/1.7.0/async_std/fs/struct.File.html#impl-AsRawFd
source 1: https://docs.rs/crate/cluFlock/1.2.5/source/src/os_release/unix.rs

// 1. Whether this will work without proper async support I'm not sure yet.
// 2. It also begs the question why the async devs didn't take https://doc.rust-lang.org/std/os/unix/io/type.RawFd.html ...
// 3. I wrote it without actually checking it, I just don't have time.

After implementing this trait, all Api calls will work the same as with a regular file, another question is whether these system calls will work.

from cluflock.

vlovich avatar vlovich commented on June 30, 2024

Thanks!

from cluflock.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.