Skip to content

Document built-in modules #465

@udoprog

Description

@udoprog

Since #464, native modules can now be documented.

Missing features:

  • Generating links from full rune paths.
  • Running documentation tests. This ensures that the documentation is correct and as a bonus ensures that public features are tested.

This is a tracking issue for modules and functions which are still lacking documentation.

  • ::std::any
  • ::std::bytes
  • ::std::char
  • ::std::cmp
  • ::std::collections
  • ::std::core
  • ::std::float
  • ::std::fmt
  • ::std::future
  • ::std::generator
  • ::std::int
  • ::std::io
  • ::std::iter
  • ::std::macros
  • ::std::mem (More associated documentation #474)
  • ::std::object
  • ::std::ops
  • ::std::option
  • ::std::result
  • ::std::stream
  • ::std::string
  • ::std::test
  • ::std::vec

Since many functions mimic what's available in Rust, documentation from there can be adapted for Rune, such as this example from is_alphabetic (see Rust version here). The appropriate licensing attribution will be added before this is released.

/// Returns `true` if this `char` has the `Alphabetic` property.
///
/// `Alphabetic` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and
/// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`].
///
/// [Unicode Standard]: https://www.unicode.org/versions/latest/
/// [ucd]: https://www.unicode.org/reports/tr44/
/// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt
///
/// # Examples
///
/// ```rune
/// assert!('a'.is_alphabetic());
/// assert!('京'.is_alphabetic());
///
/// let c = '💝';
/// // love is many things, but it is not alphabetic
/// assert!(!c.is_alphabetic());
/// ```
#[rune::function(instance)]
#[inline]
fn is_alphabetic(c: char) -> bool {
    char::is_alphabetic(c)
}

Future

  • Type and variant level documentation is not yet supported. But is expected to be produced through the Any derive.
  • Documentation for vm-accelerated functionality is still missing. Such as vector indexing. Once support for this is added, those will be added to this as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions