about summary refs log tree commit diff
path: root/src/doc/guide-ffi.md
AgeCommit message (Collapse)AuthorLines
2015-01-16Grammar tweak to old guide stub documents.Tim Parenti-1/+1
Removes extra "the" from the phrase "the the Rust Programming Language book", which isn't particularly grammatical.
2015-01-09Add stub deprecation files for each of the old guides.Huon Wilson-0/+4
There are hundreds of stackoverflow answers, reddit posts and blog articles that link to these documents, so it's a nicer user experience if they're not plain 404s. The intention is to let these hang around only for relatively short while. The alpha is likely to bring in many new users and they will be reading the documents mentioned above.
2015-01-08"The Rust Programming Language"Steve Klabnik-546/+0
This pulls all of our long-form documentation into a single document, nicknamed "the book" and formally titled "The Rust Programming Language." A few things motivated this change: * People knew of The Guide, but not the individual Guides. This merges them together, helping discoverability. * You can get all of Rust's longform documentation in one place, which is nice. * We now have rustbook in-tree, which can generate this kind of documentation. While its style is basic, the general idea is much better: a table of contents on the left-hand side. * Rather than a almost 10,000-line guide.md, there are now smaller files per section.
2015-01-07Test fixes and rebase conflictsAlex Crichton-1/+2
2015-01-05std: Redesign c_str and c_vecAlex Crichton-23/+27
This commit is an implementation of [RFC 494][rfc] which removes the entire `std::c_vec` module and redesigns the `std::c_str` module as `std::ffi`. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0494-c_str-and-c_vec-stability.md The interface of the new `CString` is outlined in the linked RFC, the primary changes being: * The `ToCStr` trait is gone, meaning the `with_c_str` and `to_c_str` methods are now gone. These two methods are replaced with a `CString::from_slice` method. * The `CString` type is now just a wrapper around `Vec<u8>` with a static guarantee that there is a trailing nul byte with no internal nul bytes. This means that `CString` now implements `Deref<Target = [c_char]>`, which is where it gains most of its methods from. A few helper methods are added to acquire a slice of `u8` instead of `c_char`, as well as including a slice with the trailing nul byte if necessary. * All usage of non-owned `CString` values is now done via two functions inside of `std::ffi`, called `c_str_to_bytes` and `c_str_to_bytes_with_nul`. These functions are now the one method used to convert a `*const c_char` to a Rust slice of `u8`. Many more details, including newly deprecated methods, can be found linked in the RFC. This is a: [breaking-change] Closes #20444
2015-01-02std: Stabilize the prelude moduleAlex Crichton-0/+2
This commit is an implementation of [RFC 503][rfc] which is a stabilization story for the prelude. Most of the RFC was directly applied, removing reexports. Some reexports are kept around, however: * `range` remains until range syntax has landed to reduce churn. * `Path` and `GenericPath` remain until path reform lands. This is done to prevent many imports of `GenericPath` which will soon be removed. * All `io` traits remain until I/O reform lands so imports can be rewritten all at once to `std::io::prelude::*`. This is a breaking change because many prelude reexports have been removed, and the RFC can be consulted for the exact list of removed reexports, as well as to find the locations of where to import them. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md [breaking-change] Closes #20068
2014-10-29Rename fail! to panic!Steve Klabnik-1/+1
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-13rollup merge of #17993 : redcape/fix-ffi-docsAlex Crichton-1/+1
2014-10-13Doc: Fix C-Code Example in FFI DocsGil Cottle-1/+1
Add missing void* for passed RustObject.
2014-10-12Continue cfg syntax transitionSteven Fackler-1/+1
All deprecation warnings have been converted to errors. This includes the warning for multiple cfgs on one item. We'll leave that as an error for some period of time to ensure that all uses are updated before the behavior changes from "or" to "and".
2014-09-12Use a space after colons per the Rust coding style:Damien Grassart-2/+2
https://github.com/rust-lang/rust-guidelines/blob/master/style/whitespace.md
2014-09-12The example code uses trigger_callback(), not do_callback().Damien Grassart-1/+1
2014-08-30auto merge of #16393 : SimonSapin/rust/patch-9, r=steveklabnikbors-2/+2
2014-08-30Unify non-snake-case lints and non-uppercase statics lintsP1start-1/+1
This unifies the `non_snake_case_functions` and `uppercase_variables` lints into one lint, `non_snake_case`. It also now checks for non-snake-case modules. This also extends the non-camel-case types lint to check type parameters, and merges the `non_uppercase_pattern_statics` lint into the `non_uppercase_statics` lint. Because the `uppercase_variables` lint is now part of the `non_snake_case` lint, all non-snake-case variables that start with lowercase characters (such as `fooBar`) will now trigger the `non_snake_case` lint. New code should be updated to use the new `non_snake_case` lint instead of the previous `non_snake_case_functions` and `uppercase_variables` lints. All use of the `non_uppercase_pattern_statics` should be replaced with the `non_uppercase_statics` lint. Any code that previously contained non-snake-case module or variable names should be updated to use snake case names or disable the `non_snake_case` lint. Any code with non-camel-case type parameters should be changed to use camel case or disable the `non_camel_case_types` lint. [breaking-change]
2014-08-25Replace mention of ~T by Box<T> in the FFI guide.Simon Sapin-2/+2
2014-08-21Fix FFI guideCorey Richardson-0/+1
2014-08-20docs: don't claim struct layout is specified, but mention reprCorey Richardson-9/+9
2014-08-12Minor changes to `rust.md`, and `guide-ffi.md`.Bheesham Persaud-3/+3
* `rust.md`: whanges for consistency * `guide-ffi.md`: wrapped inline code
2014-07-04doc/guide-ffi: A few minor typo/language fixesAnton Lofgren-7/+7
Signed-off-by: Anton Lofgren <alofgren@op5.com>
2014-06-28Rename all raw pointers as necessaryAlex Crichton-11/+11
2014-06-02docs: Stop using `notrust`Florian Gilcher-2/+2
Now that rustdoc understands proper language tags as the code not being Rust, we can tag everything properly. This change tags examples in other languages by their language. Plain notations are marked as `text`. Console examples are marked as `console`. Also fix markdown.rs to not highlight non-rust code.
2014-05-30Fix outgoing link to snappy in the FFI guideTom Jakubowski-2/+2
Google have migrated snappy to GitHub.
2014-05-30windows: Allow snake_case errors for now.Kevin Butler-0/+1
2014-05-22docs: Add win64 calling conventionRicho Healey-0/+1
2014-05-07auto merge of #13958 : pcwalton/rust/detilde, r=pcwaltonbors-1/+1
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. r? @brson or @alexcrichton or whoever
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-1/+1
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-03rustdoc: Have no_run imply no_transAlex Crichton-21/+11
This allows writing code examples which pass all analysis of the compiler, but don't actually link. A good example is examples that use extern {} blocks. Closes #12903
2014-04-20Fix spelling mistakes in documentation and code.Joseph Crail-1/+1
2014-04-12doc: Un-ignore lots of guide-ffi testsAlex Crichton-23/+58
Using some strategically-placed `#` markers most of the examples are testable (and their contents are nontrivial). Closes #13445
2014-04-10Document the nullable pointer optimization in the FFI guideCorey Richardson-0/+13
Closes #8748
2014-04-04Fix fallout from std::libc separationCorey Richardson-5/+11
2014-03-20rename std::vec -> std::sliceDaniel Micay-3/+3
Closes #12702
2014-03-15docs: begin a "low-level & unsafe code" guide.Huon Wilson-79/+0
This aims to cover the basics of writing safe unsafe code. At the moment it is just designed to be a better place for the `asm!()` docs than the detailed release notes wiki page, and I took the time to write up some other things. More examples are needed, especially of things that can subtly go wrong; and vast areas of `unsafe`-ty aren't covered, e.g. `static mut`s and thread-safety in general.
2014-03-09docs: adjust code blocks to pass with rustdoc.Huon Wilson-2/+6
The changes are basically just because rustdoc runs tests/rendering on more snippets by default (i.e. everything without a `notrust` tag), and not anything significant.
2014-02-15std: clean up ptr a bitCorey Richardson-5/+5
2014-02-13remove duplicate function from std::ptr (is_null, is_not_null, offset, ↵JeremyLetang-1/+1
mut_offset)
2014-02-09std: Add move_val_init to mem. Replace direct intrinsic usageBrian Anderson-2/+1
2014-02-09std: Add init and uninit to mem. Replace direct intrinsic usageBrian Anderson-1/+2
2014-02-06Update link_name=... -> link(name=...Cole Mickens-1/+1
2014-02-02Move doc/ to src/doc/Alex Crichton-0/+567
We generate documentation into the doc/ directory, so we shouldn't be intermingling source files with generated files