Skip to content

Support CStr literals. #66

@reitermarkus

Description

@reitermarkus

Would be nice to be able to specify C-string literals directly, e.g.

const C_STRING: &CStr = match CStr::from_bytes_with_nul(
    concat!(
        indoc!(
            r#"
                My multi-line
                string.
            "#
        ),
        "\0",
    )
    .as_bytes(),
) {
    Ok(cstr) => cstr,
    Err(_) => panic!("Invalid C-string."),
};

vs.

const C_STRING: &CStr = indoc!(
    cr#"
        My multi-line
        string.
    "#
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions