Giter VIP home page Giter VIP logo

libuv-rs's Introduction

Build Status Latest Release Documentation

libuv-rs

A safe rust wrapper for libuv.

Getting Started

Include libuv-rs as a dependency in your Cargo.toml:

[dependencies]
libuv = "~1.0.0"

libuv-rs uses semantic versioning.

As of v2.0.1, libuv-rs supports the skip-pkg-config feature. This is passed to libuv-sys2 to skip searching for a local install of libuv via pkg-config and, instead, causes libuv-sys2 to build libuv from source.

You'll want to make sure to familiarize yourself with libuv by reading libuv's documentation. You can then familiarize yourself with libuv-rs by reading the examples and documentation.

Unimplemented

libuv-rs strives to implement wrappers for all libuv functionality. However, some functionality was purposefully excluded as rust provides implementations of its own. That is: threads and synchronization (mutexes, locks, semaphores, conditional variables, barriers, etc).

If your rust project would benefit from libuv's threading or synchronization primitives, please file an Issue on github and I'll implement wrappers for it!

Cross-Platform Considerations

libuv-rs depends on libuv-sys2, which depends on bindgen. On Windows, bindgen requires rust's msvc toolchain.

libuv-rs's People

Contributors

bmatcuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

icemic iceghost

libuv-rs's Issues

Build failure: mismatched types

Due to some changes in clang-sys, bindgen failed to build for libuv-sys. I updated to the latest bindgen in libuv-sys, but that seems to have changed a bunch of types (mostly from usize/isize to u64/i64) causing builds of libuv-rs to fail. I'll need to update all those types in libuv-rs - hoping to get to that asap this week.

For now, ensure that you are using v1.1.1 of libuv-rs - this version pegs libuv-sys2 to 1.38.0 and clang to 0.28.0 to ensure builds succeed.

Error code instead of Box<dyn Error>

I noticed some functions return Box<dyn Error>, when they can just return the error code. Is this intentional?

/// Start the handle with the given callback, which will watch the specified path for changes.
///
/// Note: Currently the only supported flag is RECURSIVE and only on OSX and Windows.
pub fn start<CB: Into<FsEventCB<'static>>>(
&mut self,
path: &str,
flags: FsEventFlags,
cb: CB,
) -> Result<(), Box<dyn std::error::Error>> {
let path = CString::new(path)?;
// uv_cb is either Some(fs_event_cb) or None
let cb = cb.into();
let uv_cb = use_c_callback!(uv_fs_event_cb, cb);
// cb is either Some(closure) or None - it is saved into data
let dataptr = crate::Handle::get_data(uv_handle!(self.handle));
if !dataptr.is_null() {
if let super::FsEventData(d) = unsafe { &mut (*dataptr).addl } {
d.fs_event_cb = cb;
}
}
crate::uvret(unsafe { uv_fs_event_start(self.handle, uv_cb, path.as_ptr(), flags.bits()) })
.map_err(|e| Box::new(e) as _)
}

Segmentation fault

error: process didn't exit successfully: target\debug\examples\server.exe (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
Segmentation fault

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.