Giter VIP home page Giter VIP logo

msquic-tokio's People

Contributors

youyuanwu avatar

Stargazers

Olivia Lian avatar

Watchers

 avatar

msquic-tokio's Issues

Native bitfield in winmd does not have rust bindings

given winmd:

public struct QUIC_SETTINGS
{
	[StructLayout(LayoutKind.Explicit)]
	public struct _Anonymous1_e__Union
	{
		public struct _IsSet_e__Struct
		{
			[NativeBitfield("MaxBytesPerKey", 0L, 1L)]
			[NativeBitfield("HandshakeIdleTimeoutMs", 1L, 1L)]
			public ulong _bitfield;
		}

		[FieldOffset(0)]
		public ulong IsSetFlags;

		[FieldOffset(0)]
		public _IsSet_e__Struct IsSet;
	}

	public _Anonymous1_e__Union Anonymous1;

	public ulong MaxBytesPerKey;

	public ulong HandshakeIdleTimeoutMs;
}

There is no NativeBitfield support in generated Rust:

#[repr(C)]
pub struct QUIC_SETTINGS {
    pub Anonymous1: QUIC_SETTINGS_0,
    pub MaxBytesPerKey: u64,
    pub HandshakeIdleTimeoutMs: u64
}
#[repr(C)]
pub union QUIC_SETTINGS_0 {
    pub IsSetFlags: u64,
    pub IsSet: QUIC_SETTINGS_0_0,
}
#[repr(C)]
pub struct QUIC_SETTINGS_0_0 {
    pub _bitfield: u64,
}

C code is like this that is used to generate winmd:

typedef struct QUIC_SETTINGS {

    union {
        uint64_t IsSetFlags;
        struct {
            uint64_t MaxBytesPerKey                         : 1;
            uint64_t HandshakeIdleTimeoutMs                 : 1;
 
        } IsSet;
    };

} QUIC_SETTINGS;

The intended use in c:

    // config
    QUIC_SETTINGS Settings = {0};
    Settings.MaxBytesPerKey                         = 1000;
    Settings.IsSet.MaxBytesPerKey                 = TRUE;

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.