<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/libnative/io/timer_timerfd.rs, branch try</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2014-04-12T20:42:07+00:00</updated>
<entry>
<title>native: Remove timerfd implementation on linux</title>
<updated>2014-04-12T20:42:07+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-04-11T04:44:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=28ba3a7bc3e1561528e3d441ad653ac849ee07ea'/>
<id>urn:sha1:28ba3a7bc3e1561528e3d441ad653ac849ee07ea</id>
<content type='text'>
Rust advertises itself as being compatible with linux 2.6.18, but the timerfd
set of syscalls weren't added until linux 2.6.25. There is no real need for a
specialized timer implementation beyond being a "little more accurate", but the
select() implementation will suffice for now.

If it is later deemed that an accurate timerfd implementation is needed, it can
be added then through some method which will allow the standard distribution to
continue to be compatible with 2.6.18

Closes #13447
</content>
</entry>
<entry>
<title>std: Make std::comm return types consistent</title>
<updated>2014-04-11T04:41:19+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-04-10T17:53:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=545d4718c8e1b9e69474165a1cb38d873627183d'/>
<id>urn:sha1:545d4718c8e1b9e69474165a1cb38d873627183d</id>
<content type='text'>
There are currently a number of return values from the std::comm methods, not
all of which are necessarily completely expressive:

  Sender::try_send(t: T) -&gt; bool
    This method currently doesn't transmit back the data `t` if the send fails
    due to the other end having disconnected. Additionally, this shares the name
    of the synchronous try_send method, but it differs in semantics in that it
    only has one failure case, not two (the buffer can never be full).

  SyncSender::try_send(t: T) -&gt; TrySendResult&lt;T&gt;
    This method accurately conveys all possible information, but it uses a
    custom type to the std::comm module with no convenience methods on it.
    Additionally, if you want to inspect the result you're forced to import
    something from `std::comm`.

  SyncSender::send_opt(t: T) -&gt; Option&lt;T&gt;
    This method uses Some(T) as an "error value" and None as a "success value",
    but almost all other uses of Option&lt;T&gt; have Some/None the other way

  Receiver::try_recv(t: T) -&gt; TryRecvResult&lt;T&gt;
    Similarly to the synchronous try_send, this custom return type is lacking in
    terms of usability (no convenience methods).

With this number of drawbacks in mind, I believed it was time to re-work the
return types of these methods. The new API for the comm module is:

  Sender::send(t: T) -&gt; ()
  Sender::send_opt(t: T) -&gt; Result&lt;(), T&gt;
  SyncSender::send(t: T) -&gt; ()
  SyncSender::send_opt(t: T) -&gt; Result&lt;(), T&gt;
  SyncSender::try_send(t: T) -&gt; Result&lt;(), TrySendError&lt;T&gt;&gt;
  Receiver::recv() -&gt; T
  Receiver::recv_opt() -&gt; Result&lt;T, ()&gt;
  Receiver::try_recv() -&gt; Result&lt;T, TryRecvError&gt;

The notable changes made are:

* Sender::try_send =&gt; Sender::send_opt. This renaming brings the semantics in
  line with the SyncSender::send_opt method. An asychronous send only has one
  failure case, unlike the synchronous try_send method which has two failure
  cases (full/disconnected).

* Sender::send_opt returns the data back to the caller if the send is guaranteed
  to fail. This method previously returned `bool`, but then it was unable to
  retrieve the data if the data was guaranteed to fail to send. There is still a
  race such that when `Ok(())` is returned the data could still fail to be
  received, but that's inherent to an asynchronous channel.

* Result is now the basis of all return values. This not only adds lots of
  convenience methods to all return values for free, but it also means that you
  can inspect the return values with no extra imports (Ok/Err are in the
  prelude). Additionally, it's now self documenting when something failed or not
  because the return value has "Err" in the name.

Things I'm a little uneasy about:

* The methods send_opt and recv_opt are not returning options, but rather
  results. I felt more strongly that Option was the wrong return type than the
  _opt prefix was wrong, and I coudn't think of a much better name for these
  methods. One possible way to think about them is to read the _opt suffix as
  "optionally".

* Result&lt;T, ()&gt; is often better expressed as Option&lt;T&gt;. This is only applicable
  to the recv_opt() method, but I thought it would be more consistent for
  everything to return Result rather than one method returning an Option.

Despite my two reasons to feel uneasy, I feel much better about the consistency
in return values at this point, and I think the only real open question is if
there's a better suffix for {send,recv}_opt.

Closes #11527
</content>
</entry>
<entry>
<title>native: remove some internal ~[].</title>
<updated>2014-04-10T22:21:58+00:00</updated>
<author>
<name>Huon Wilson</name>
<email>dbau.pp+github@gmail.com</email>
</author>
<published>2014-04-09T09:41:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=32cf4a188c220d1d36a153af19ede1eb43cace05'/>
<id>urn:sha1:32cf4a188c220d1d36a153af19ede1eb43cace05</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix fallout from std::libc separation</title>
<updated>2014-04-04T16:31:44+00:00</updated>
<author>
<name>Corey Richardson</name>
<email>corey@octayn.net</email>
</author>
<published>2014-02-26T17:58:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=0459ee77d0c764cc27950465cb19053e1456cc95'/>
<id>urn:sha1:0459ee77d0c764cc27950465cb19053e1456cc95</id>
<content type='text'>
</content>
</entry>
<entry>
<title>native: Switch field privacy as necessary</title>
<updated>2014-03-31T22:47:35+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-03-27T22:10:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=14587f88cac89af655e04d573ead2eb5ab4f37a5'/>
<id>urn:sha1:14587f88cac89af655e04d573ead2eb5ab4f37a5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>log: Introduce liblog, the old std::logging</title>
<updated>2014-03-16T05:26:36+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-03-09T06:11:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cc6ec8df95fbd8163b7c2c6c34469fb96b704e66'/>
<id>urn:sha1:cc6ec8df95fbd8163b7c2c6c34469fb96b704e66</id>
<content type='text'>
This commit moves all logging out of the standard library into an external
crate. This crate is the new crate which is responsible for all logging macros
and logging implementation. A few reasons for this change are:

* The crate map has always been a bit of a code smell among rust programs. It
  has difficulty being loaded on almost all platforms, and it's used almost
  exclusively for logging and only logging. Removing the crate map is one of the
  end goals of this movement.

* The compiler has a fair bit of special support for logging. It has the
  __log_level() expression as well as generating a global word per module
  specifying the log level. This is unfairly favoring the built-in logging
  system, and is much better done purely in libraries instead of the compiler
  itself.

* Initialization of logging is much easier to do if there is no reliance on a
  magical crate map being available to set module log levels.

* If the logging library can be written outside of the standard library, there's
  no reason that it shouldn't be. It's likely that we're not going to build the
  highest quality logging library of all time, so third-party libraries should
  be able to provide just as high-quality logging systems as the default one
  provided in the rust distribution.

With a migration such as this, the change does not come for free. There are some
subtle changes in the behavior of liblog vs the previous logging macros:

* The core change of this migration is that there is no longer a physical
  log-level per module. This concept is still emulated (it is quite useful), but
  there is now only a global log level, not a local one. This global log level
  is a reflection of the maximum of all log levels specified. The previously
  generated logging code looked like:

    if specified_level &lt;= __module_log_level() {
        println!(...)
    }

  The newly generated code looks like:

    if specified_level &lt;= ::log::LOG_LEVEL {
        if ::log::module_enabled(module_path!()) {
            println!(...)
        }
    }

  Notably, the first layer of checking is still intended to be "super fast" in
  that it's just a load of a global word and a compare. The second layer of
  checking is executed to determine if the current module does indeed have
  logging turned on.

  This means that if any module has a debug log level turned on, all modules
  with debug log levels get a little bit slower (they all do more expensive
  dynamic checks to determine if they're turned on or not).

  Semantically, this migration brings no change in this respect, but
  runtime-wise, this will have a perf impact on some code.

* A `RUST_LOG=::help` directive will no longer print out a list of all modules
  that can be logged. This is because the crate map will no longer specify the
  log levels of all modules, so the list of modules is not known. Additionally,
  warnings can no longer be provided if a malformed logging directive was
  supplied.

The new "hello world" for logging looks like:

    #[phase(syntax, link)]
    extern crate log;

    fn main() {
        debug!("Hello, world!");
    }
</content>
</entry>
<entry>
<title>std: Rename Chan/Port types and constructor</title>
<updated>2014-03-13T20:23:29+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-03-09T21:58:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=78580651131c9daacd7e5e4669af819cdd719f09'/>
<id>urn:sha1:78580651131c9daacd7e5e4669af819cdd719f09</id>
<content type='text'>
* Chan&lt;T&gt; =&gt; Sender&lt;T&gt;
* Port&lt;T&gt; =&gt; Receiver&lt;T&gt;
* Chan::new() =&gt; channel()
* constructor returns (Sender, Receiver) instead of (Receiver, Sender)
* local variables named `port` renamed to `rx`
* local variables named `chan` renamed to `tx`

Closes #11765
</content>
</entry>
<entry>
<title>native: Move from usleep() to nanosleep()</title>
<updated>2014-03-05T17:11:10+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-03-05T01:40:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d8bd8de82e19702ad26fff704ff9a4890ebe1bf7'/>
<id>urn:sha1:d8bd8de82e19702ad26fff704ff9a4890ebe1bf7</id>
<content type='text'>
Using nanosleep() allows us to gracefully recover from EINTR because on error it
fills in the second parameter with the remaining time to sleep.

Closes #12689
</content>
</entry>
<entry>
<title>Publicise types/add #[allow(visible_private_types)] to a variety of places.</title>
<updated>2014-02-28T13:12:34+00:00</updated>
<author>
<name>Huon Wilson</name>
<email>dbau.pp+github@gmail.com</email>
</author>
<published>2014-02-27T07:48:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=218eae06ab7c7858057cc6bbd28fb4e0db9f5264'/>
<id>urn:sha1:218eae06ab7c7858057cc6bbd28fb4e0db9f5264</id>
<content type='text'>
There's a lot of these types in the compiler libraries, and a few of the
older or private stdlib ones. Some types are obviously meant to be
public, others not so much.
</content>
</entry>
<entry>
<title>native: Improve windows file handling</title>
<updated>2014-02-27T20:03:57+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-02-26T20:57:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cd9010c77e764e9348ecd92dc4a285f6514505dc'/>
<id>urn:sha1:cd9010c77e764e9348ecd92dc4a285f6514505dc</id>
<content type='text'>
This commit splits the file implementation into file_unix and file_win32. The
two implementations have diverged to the point that they share almost 0 code at
this point, so it's easier to maintain as separate files.

The other major change accompanied with this commit is that file::open is no
longer based on libc's open function on windows, but rather windows's CreateFile
function. This fixes dealing with binary files on windows (test added in
previous commit).

This also changes the read/write functions to use ReadFile and WriteFile instead
of libc's read/write.

Closes #12406
</content>
</entry>
</feed>
