GithubHelp home page GithubHelp logo

tiby312 / guid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dherman/guid

0.0 2.0 0.0 11 KB

A macro providing a convenient literal syntax for creating Windows GUIDs.

License: Apache License 2.0

Rust 100.00%

guid's Introduction

GUID

This crate provides a guid! macro for expressing GUID structs with a convenient literal syntax. A GUID is a Windows globally unique identifier, usually expressed in the following format:

{6B29FC40-CA47-1067-B31D-00DD010662DA}

With this crate, a GUID can be generated with the syntax:

guid!{"6B29FC40-CA47-1067-B31D-00DD010662DA"}

Example

#[macro_use]
extern crate guid;

use guid::GUID;

const MY_GUID: GUID = guid!{"6B29FC40-CA47-1067-B31D-00DD010662DA"};

fn main() {
    assert_eq!(MY_GUID.Data1, 0x6B29FC40);
    assert_eq!(MY_GUID.Data2, 0xCA47);
    assert_eq!(MY_GUID.Data3, 0x1067);
    assert_eq!(MY_GUID.Data4, [ 0xB3, 0x1D, 0x00, 0xDD, 0x01, 0x06, 0x62, 0xDA ]);
}

The GUID type is re-exported from the winapi crate, and is only available in Windows. The guid! macro is also only available in Windows.

This crate also provides a parser, which can be used to parse GUID strings at runtime. The parser is only available to generate an array of bytes on non-Windows platforms. In Windows, this crate defines a parser that produces a GUID struct.

Compatibility

This crate supports all versions of Rust (stable and nightly) starting with Rust 1.15.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

guid's People

Contributors

dherman avatar

Watchers

James Cloos avatar  avatar

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.