Struct AssemblyOSBuilder

pub struct AssemblyOSBuilder { /* private fields */ }
Expand description

Builder for constructing AssemblyOS table entries

Provides a fluent interface for building AssemblyOS metadata table entries. These entries specify operating system targeting information for assemblies, though they are rarely used in modern .NET applications which rely on runtime platform abstraction.

§Required Fields

  • os_platform_id: Operating system platform identifier
  • os_major_version: Major version number of the target OS
  • os_minor_version: Minor version number of the target OS

§Historical Context

The AssemblyOS table was designed for early .NET Framework scenarios where assemblies might need explicit OS compatibility declarations. Modern applications typically rely on runtime platform abstraction instead of metadata-level OS targeting.

§Examples

use dotscope::prelude::*;

// Windows 10 targeting
let win10_os = AssemblyOSBuilder::new()
    .os_platform_id(1)    // Windows platform
    .os_major_version(10)  // Windows 10
    .os_minor_version(0)   // Windows 10.0
    .build(&mut context)?;

// Windows 7 targeting
let win7_os = AssemblyOSBuilder::new()
    .os_platform_id(1)    // Windows platform
    .os_major_version(6)   // Windows 7
    .os_minor_version(1)   // Windows 7.1
    .build(&mut context)?;

// Custom OS targeting
let custom_os = AssemblyOSBuilder::new()
    .os_platform_id(99)    // Custom platform
    .os_major_version(1)    // Major version
    .os_minor_version(0)    // Minor version
    .build(&mut context)?;

Implementations§

§

impl AssemblyOSBuilder

pub fn new() -> Self

Creates a new AssemblyOSBuilder with default values

Initializes a new builder instance with all fields unset. The caller must provide all required fields before calling build().

§Returns

A new AssemblyOSBuilder instance ready for configuration

§Examples
use dotscope::prelude::*;

let builder = AssemblyOSBuilder::new();

pub fn os_platform_id(self, os_platform_id: u32) -> Self

Sets the operating system platform identifier

Specifies the target operating system platform. While ECMA-335 doesn’t standardize exact values, common historical identifiers include Windows, Unix, and other platform designations.

§Parameters
  • os_platform_id: The operating system platform identifier
§Returns

Self for method chaining

§Common Values
  • 1: Windows platforms
  • 2: Unix/Linux platforms
  • 3: macOS platforms
  • Custom values for proprietary platforms
§Examples
use dotscope::prelude::*;

// Windows platform
let builder = AssemblyOSBuilder::new()
    .os_platform_id(1);

// Unix/Linux platform
let builder = AssemblyOSBuilder::new()
    .os_platform_id(2);

pub fn os_major_version(self, os_major_version: u32) -> Self

Sets the major version number of the target OS

Specifies the major version of the target operating system. Combined with minor version to specify exact OS version requirements.

§Parameters
  • os_major_version: The major version number
§Returns

Self for method chaining

§Examples
use dotscope::prelude::*;

// Windows 10 (major version 10)
let builder = AssemblyOSBuilder::new()
    .os_major_version(10);

// Windows 7 (major version 6)
let builder = AssemblyOSBuilder::new()
    .os_major_version(6);

pub fn os_minor_version(self, os_minor_version: u32) -> Self

Sets the minor version number of the target OS

Specifies the minor version of the target operating system. Combined with major version to specify exact OS version requirements.

§Parameters
  • os_minor_version: The minor version number
§Returns

Self for method chaining

§Examples
use dotscope::prelude::*;

// Windows 10.0 (minor version 0)
let builder = AssemblyOSBuilder::new()
    .os_minor_version(0);

// Windows 7.1 (minor version 1)
let builder = AssemblyOSBuilder::new()
    .os_minor_version(1);

pub fn build(self, context: &mut BuilderContext) -> Result<Token>

Builds and adds the AssemblyOS entry to the metadata

Validates all required fields, creates the AssemblyOS table entry, and adds it to the builder context. Returns a token that can be used to reference this assembly OS entry.

§Parameters
  • context: Mutable reference to the builder context
§Returns
  • Ok(Token): Token referencing the created assembly OS entry
  • Err(Error): If validation fails or table operations fail
§Errors
  • Missing required field (os_platform_id, os_major_version, or os_minor_version)
  • Table operations fail due to metadata constraints
§Examples
use dotscope::prelude::*;

let mut context = BuilderContext::new();
let token = AssemblyOSBuilder::new()
    .os_platform_id(1)
    .os_major_version(10)
    .os_minor_version(0)
    .build(&mut context)?;

Trait Implementations§

§

impl Clone for AssemblyOSBuilder

§

fn clone(&self) -> AssemblyOSBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for AssemblyOSBuilder

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Default for AssemblyOSBuilder

§

fn default() -> Self

Creates a default AssemblyOSBuilder

Equivalent to calling AssemblyOSBuilder::new().

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.