idl

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDLAddress

func IDLAddress(programID solana.PublicKey) (solana.PublicKey, error)

func IsNil

func IsNil(v interface{}) bool

func IsOldIdl

func IsOldIdl(raw []byte) bool

Types

type Array

type Array[T any, L IdlArrayLen] struct {
	Inner  T
	Length L
}

type Defined

type Defined struct {
	Name     string                  `json:"name"`
	Generics []idltype.IdlGenericArg `json:"generics,omitzero"`
}

type Generic

type Generic string

type IdTypeDef_slice

type IdTypeDef_slice []IdlTypeDef

func (IdTypeDef_slice) ByName

func (slice IdTypeDef_slice) ByName(name string) *IdlTypeDef

ByName returns the IdlTypeDef with the given name, or nil if not found.

type Idl

type Idl struct {
	//     pub address: String,
	Address *solana.PublicKey `json:"address,omitzero"`

	//	    pub metadata: IdlMetadata,
	Metadata IdlMetadata `json:"metadata,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub docs: Vec<String>,
	Docs []string `json:"docs,omitzero"`

	//	    pub instructions: Vec<IdlInstruction>,
	Instructions []IdlInstruction `json:"instructions"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub accounts: Vec<IdlAccount>,
	Accounts []IdlAccount `json:"accounts,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub events: Vec<IdlEvent>,
	Events []IdlEvent `json:"events,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub errors: Vec<IdlErrorCode>,
	Errors []IdlErrorCode `json:"errors,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub types: Vec<IdlTypeDef>,
	Types IdTypeDef_slice `json:"types,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub constants: Vec<IdlConst>,
	Constants []IdlConst `json:"constants,omitzero"`
}

pub struct Idl {

func Parse

func Parse(data []byte) (*Idl, error)

func ParseFromFilepath

func ParseFromFilepath(path string) (*Idl, error)

func (*Idl) UnmarshalJSON

func (i *Idl) UnmarshalJSON(data []byte) error

Idl.UnmarshalJSON

func (*Idl) Validate

func (idlObj *Idl) Validate() *ValidationErrors

type IdlAccount

type IdlAccount struct {
	//	    pub name: String,
	Name string `json:"name"`

	//	    pub discriminator: IdlDiscriminator,
	Discriminator IdlDiscriminator `json:"discriminator"`
}

pub struct IdlAccount {

type IdlArrayLen

type IdlArrayLen interface {
	// contains filtered or unexported methods
}

#[serde(rename_all = "lowercase")]

pub enum IdlArrayLen {
    Generic(String),
    #[serde(untagged)]
    Value(usize),
}

type IdlConst

type IdlConst struct {
	//	    pub name: String,
	Name string `json:"name"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub docs: Vec<String>,
	Docs []string `json:"docs,omitzero"`

	//	    #[serde(rename = "type")]
	//	    pub ty: IdlType,
	Ty idltype.IdlType `json:"type"`

	//	    pub value: String,
	Value string `json:"value"`
}

pub struct IdlConst {

func (*IdlConst) UnmarshalJSON

func (i *IdlConst) UnmarshalJSON(data []byte) error

type IdlDefinedFields

type IdlDefinedFields interface {
	// contains filtered or unexported methods
}

#[serde(untagged)]

pub enum IdlDefinedFields {
    Named(Vec<IdlField>),
    Tuple(Vec<IdlType>),
}

type IdlDefinedFieldsNamed

type IdlDefinedFieldsNamed []IdlField

func (*IdlDefinedFieldsNamed) UnmarshalJSON

func (f *IdlDefinedFieldsNamed) UnmarshalJSON(data []byte) error

type IdlDefinedFieldsTuple

type IdlDefinedFieldsTuple []idltype.IdlType

func (*IdlDefinedFieldsTuple) UnmarshalJSON

func (f *IdlDefinedFieldsTuple) UnmarshalJSON(data []byte) error

type IdlDependency

type IdlDependency struct {
	//     pub name: String,
	Name string `json:"name"`
	//     pub version: String,
	Version string `json:"version"`
}

pub struct IdlDependency {

type IdlDeployments

type IdlDeployments struct {
	//     pub mainnet: Option<String>,
	Mainnet Option[string] `json:"mainnet"`
	//     pub testnet: Option<String>,
	Testnet Option[string] `json:"testnet"`
	//     pub devnet: Option<String>,
	Devnet Option[string] `json:"devnet"`
	//     pub localnet: Option<String>,
	Localnet Option[string] `json:"localnet"`
}

pub struct IdlDeployments {

type IdlDiscriminator

type IdlDiscriminator []byte

pub type IdlDiscriminator = Vec<u8>;

func (IdlDiscriminator) IsEmpty

func (di IdlDiscriminator) IsEmpty() bool

IsEmpty returns true if the IdlDiscriminator is empty.

func (IdlDiscriminator) MarshalJSON

func (di IdlDiscriminator) MarshalJSON() ([]byte, error)

MarshalJSON

func (*IdlDiscriminator) UnmarshalJSON

func (di *IdlDiscriminator) UnmarshalJSON(data []byte) error

UnmarshalJSON

type IdlEnumVariant

type IdlEnumVariant struct {
	//	    pub name: String,
	Name string `json:"name"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub fields: Option<IdlDefinedFields>,
	Fields Option[IdlDefinedFields] `json:"fields,omitzero"`
}

pub struct IdlEnumVariant {

func (*IdlEnumVariant) IsSimple

func (variant *IdlEnumVariant) IsSimple() bool

func (*IdlEnumVariant) UnmarshalJSON

func (i *IdlEnumVariant) UnmarshalJSON(data []byte) error

type IdlErrorCode

type IdlErrorCode struct {
	//	    pub code: u32,
	Code uint32 `json:"code"`

	//	    pub name: String,
	Name string `json:"name"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub msg: Option<String>,
	Msg Option[string] `json:"msg,omitzero"`
}

pub struct IdlErrorCode {

type IdlEvent

type IdlEvent struct {
	//     pub name: String,
	Name string `json:"name"`
	//     pub discriminator: IdlDiscriminator,
	Discriminator IdlDiscriminator `json:"discriminator"`
}

pub struct IdlEvent {

type IdlField

type IdlField struct {
	//	    pub name: String,
	Name string `json:"name"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub docs: Vec<String>,
	Docs []string `json:"docs,omitzero"`

	//	    #[serde(rename = "type")]
	//	    pub ty: IdlType,
	Ty idltype.IdlType `json:"type"`
}

pub struct IdlField {

func (*IdlField) UnmarshalJSON

func (f *IdlField) UnmarshalJSON(data []byte) error

type IdlInstruction

type IdlInstruction struct {
	//	    pub name: String,
	Name string `json:"name"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub docs: Vec<String>,
	Docs []string `json:"docs,omitzero"`

	//	    pub discriminator: IdlDiscriminator,
	Discriminator IdlDiscriminator `json:"discriminator"`

	//	    pub accounts: Vec<IdlInstructionAccountItem>,
	Accounts []IdlInstructionAccountItem `json:"accounts"`

	Args []IdlField `json:"args"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub returns: Option<IdlType>,
	Returns Option[idltype.IdlType] `json:"returns,omitzero"`
}

pub struct IdlInstruction {

func (*IdlInstruction) ComputeDiscriminator

func (i *IdlInstruction) ComputeDiscriminator() (out [8]byte)

func (*IdlInstruction) UnmarshalJSON

func (ix *IdlInstruction) UnmarshalJSON(data []byte) error

type IdlInstructionAccount

type IdlInstructionAccount struct {
	//	    pub name: String,
	Name string `json:"name"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub docs: Vec<String>,
	Docs []string `json:"docs,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub writable: bool,
	Writable bool `json:"writable,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub signer: bool,
	Signer bool `json:"signer,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub optional: bool,
	Optional bool `json:"optional,omitzero"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub address: Option<String>,
	Address Option[solana.PublicKey] `json:"address,omitzero"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub pda: Option<IdlPda>,
	Pda Option[IdlPda] `json:"pda,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub relations: Vec<String>,
	Relations []string `json:"relations,omitzero"`
}

pub struct IdlInstructionAccount {

func (*IdlInstructionAccount) UnmarshalJSON

func (i *IdlInstructionAccount) UnmarshalJSON(data []byte) error

type IdlInstructionAccountItem

type IdlInstructionAccountItem interface {
	// contains filtered or unexported methods
}
pub enum IdlInstructionAccountItem {
 Composite(IdlInstructionAccounts),
 Single(IdlInstructionAccount),
}

type IdlInstructionAccounts

type IdlInstructionAccounts struct {
	//	    pub name: String,
	Name string `json:"name"`
	//	    pub accounts: Vec<IdlInstructionAccountItem>,
	Accounts []IdlInstructionAccountItem `json:"accounts"`
}

pub struct IdlInstructionAccounts {

func (*IdlInstructionAccounts) UnmarshalJSON

func (ia *IdlInstructionAccounts) UnmarshalJSON(data []byte) error

type IdlMetadata

type IdlMetadata struct {
	//	    pub name: String,
	Name string `json:"name"`

	//	    pub version: String,
	Version string `json:"version"`

	//	    pub spec: String,
	Spec string `json:"spec"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub description: Option<String>,
	Description Option[string] `json:"description,omitzero"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub repository: Option<String>,
	Repository Option[string] `json:"repository,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub dependencies: Vec<IdlDependency>,
	Dependencies []IdlDependency `json:"dependencies,omitzero"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub contact: Option<String>,
	Contact Option[string] `json:"contact,omitzero"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub deployments: Option<IdlDeployments>,
	Deployments Option[IdlDeployments] `json:"deployments,omitzero"`
}

pub struct IdlMetadata {

type IdlPda

type IdlPda struct {
	//	    pub seeds: Vec<IdlSeed>,
	Seeds []IdlSeed `json:"seeds"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub program: Option<IdlSeed>,
	Program Option[IdlSeed] `json:"program,omitzero"`
}

pub struct IdlPda {

func (*IdlPda) UnmarshalJSON

func (pda *IdlPda) UnmarshalJSON(data []byte) error

type IdlRepr

type IdlRepr interface {
	// contains filtered or unexported methods
}

#[serde(tag = "kind", rename_all = "lowercase")] #[non_exhaustive]

pub enum IdlRepr {
    Rust(IdlReprModifier),
    C(IdlReprModifier),
    Transparent,
}

type IdlReprC

type IdlReprC struct {
	//	    pub kind: String,
	Kind string `json:"kind"`
	//	    #[serde(flatten)]
	//	    pub modifier: IdlReprModifier,
	IdlReprModifier
}

func (IdlReprC) MarshalJSON

func (repr IdlReprC) MarshalJSON() ([]byte, error)

func (*IdlReprC) UnmarshalJSON

func (i *IdlReprC) UnmarshalJSON(data []byte) error

type IdlReprModifier

type IdlReprModifier struct {
	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub packed: bool,
	Packed bool `json:"packed,omitzero"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub align: Option<usize>,
	Align Option[uint] `json:"align,omitzero"`
}

pub struct IdlReprModifier {

type IdlReprRust

type IdlReprRust struct {
	//	    pub kind: String,
	Kind string `json:"kind"`
	//	    #[serde(flatten)]
	//	    pub modifier: IdlReprModifier,
	IdlReprModifier
}

func (IdlReprRust) MarshalJSON

func (repr IdlReprRust) MarshalJSON() ([]byte, error)

func (*IdlReprRust) UnmarshalJSON

func (i *IdlReprRust) UnmarshalJSON(data []byte) error

type IdlReprTransparent

type IdlReprTransparent struct {
	//	    pub kind: String,
	Kind string `json:"kind"`
	//	    #[serde(flatten)]
	//	    pub modifier: IdlReprModifier,
	IdlReprModifier
}

func (IdlReprTransparent) MarshalJSON

func (repr IdlReprTransparent) MarshalJSON() ([]byte, error)

func (*IdlReprTransparent) UnmarshalJSON

func (i *IdlReprTransparent) UnmarshalJSON(data []byte) error

type IdlSeed

type IdlSeed interface {
	// contains filtered or unexported methods
}

#[serde(tag = "kind", rename_all = "lowercase")]

pub enum IdlSeed {
    Const(IdlSeedConst),
    Arg(IdlSeedArg),
    Account(IdlSeedAccount),
}

type IdlSeedAccount

type IdlSeedAccount struct {
	//	    pub path: String,
	Path string `json:"path"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub account: Option<String>,
	Account Option[string] `json:"account,omitzero"`
}

pub struct IdlSeedAccount {

func (IdlSeedAccount) MarshalJSON

func (a IdlSeedAccount) MarshalJSON() ([]byte, error)

func (*IdlSeedAccount) UnmarshalJSON

func (a *IdlSeedAccount) UnmarshalJSON(data []byte) error

type IdlSeedArg

type IdlSeedArg struct {
	//     pub path: String,
	Path string `json:"path"`
}

pub struct IdlSeedArg {

func (IdlSeedArg) MarshalJSON

func (a IdlSeedArg) MarshalJSON() ([]byte, error)

func (*IdlSeedArg) UnmarshalJSON

func (a *IdlSeedArg) UnmarshalJSON(data []byte) error

type IdlSeedConst

type IdlSeedConst struct {
	//	    pub value: Vec<u8>,
	Value []byte `json:"value"`
}

pub struct IdlSeedConst {

func (IdlSeedConst) MarshalJSON

func (c IdlSeedConst) MarshalJSON() ([]byte, error)

func (*IdlSeedConst) UnmarshalJSON

func (c *IdlSeedConst) UnmarshalJSON(data []byte) error

type IdlSerialization

type IdlSerialization interface {
	// contains filtered or unexported methods
}

#[serde(rename_all = "lowercase")] #[non_exhaustive]

pub enum IdlSerialization {
    #[default]
    Borsh,
    Bytemuck,
    BytemuckUnsafe,
    Custom(String),
}

type IdlSerializationBorsh

type IdlSerializationBorsh struct {
	// contains filtered or unexported fields
}

func (IdlSerializationBorsh) MarshalJSON

func (IdlSerializationBorsh) MarshalJSON() ([]byte, error)

func (IdlSerializationBorsh) UnmarshalJSON

func (IdlSerializationBorsh) UnmarshalJSON(data []byte) error

type IdlSerializationBytemuck

type IdlSerializationBytemuck struct {
	// contains filtered or unexported fields
}

func (IdlSerializationBytemuck) MarshalJSON

func (IdlSerializationBytemuck) MarshalJSON() ([]byte, error)

func (IdlSerializationBytemuck) UnmarshalJSON

func (IdlSerializationBytemuck) UnmarshalJSON(data []byte) error

type IdlSerializationBytemuckUnsafe

type IdlSerializationBytemuckUnsafe struct {
	// contains filtered or unexported fields
}

func (IdlSerializationBytemuckUnsafe) MarshalJSON

func (IdlSerializationBytemuckUnsafe) MarshalJSON() ([]byte, error)

func (IdlSerializationBytemuckUnsafe) UnmarshalJSON

func (IdlSerializationBytemuckUnsafe) UnmarshalJSON(data []byte) error

type IdlSerializationCustom

type IdlSerializationCustom struct {
	Custom string `json:"custom"`
	// contains filtered or unexported fields
}

func (IdlSerializationCustom) MarshalJSON

func (i IdlSerializationCustom) MarshalJSON() ([]byte, error)

func (*IdlSerializationCustom) UnmarshalJSON

func (i *IdlSerializationCustom) UnmarshalJSON(data []byte) error

type IdlTypeCallback

type IdlTypeCallback func(pathElements, idltype.IdlType) bool

type IdlTypeDef

type IdlTypeDef struct {
	//	    pub name: String,
	Name string `json:"name"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub docs: Vec<String>,
	Docs []string `json:"docs,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub serialization: IdlSerialization,
	Serialization IdlSerialization `json:"serialization,omitzero"`

	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub repr: Option<IdlRepr>,
	Repr Option[IdlRepr] `json:"repr,omitzero"`

	//	    #[serde(default, skip_serializing_if = "is_default")]
	//	    pub generics: Vec<IdlTypeDefGeneric>,
	Generics []IdlTypeDefGeneric `json:"generics,omitzero"`

	//	    #[serde(rename = "type")]
	//	    pub ty: IdlTypeDefTy,
	Ty IdlTypeDefTy `json:"type"`
}

pub struct IdlTypeDef {

func (*IdlTypeDef) UnmarshalJSON

func (i *IdlTypeDef) UnmarshalJSON(data []byte) error

type IdlTypeDefGeneric

type IdlTypeDefGeneric interface {
	// contains filtered or unexported methods
}

#[serde(tag = "kind", rename_all = "lowercase")]

pub enum IdlTypeDefGeneric {
    Type {
        name: String,
    },
    Const {
        name: String,
        #[serde(rename = "type")]
        ty: String,
    },
}

type IdlTypeDefGenericConst

type IdlTypeDefGenericConst struct {
	//	    pub kind: String,
	Kind string `json:"kind"`
	//	    pub name: String,
	Name string `json:"name"`
	//	    #[serde(rename = "type")]
	//	    pub ty: String,
	Ty string `json:"type"`
}

func (IdlTypeDefGenericConst) MarshalJSON

func (gc IdlTypeDefGenericConst) MarshalJSON() ([]byte, error)

func (*IdlTypeDefGenericConst) UnmarshalJSON

func (gc *IdlTypeDefGenericConst) UnmarshalJSON(data []byte) error

type IdlTypeDefGenericType

type IdlTypeDefGenericType struct {
	//	    pub kind: String,
	Kind string `json:"kind"`
	//	    pub name: String,
	Name string `json:"name"`
}

func (IdlTypeDefGenericType) MarshalJSON

func (gt IdlTypeDefGenericType) MarshalJSON() ([]byte, error)

func (*IdlTypeDefGenericType) UnmarshalJSON

func (gt *IdlTypeDefGenericType) UnmarshalJSON(data []byte) error

type IdlTypeDefTy

type IdlTypeDefTy interface {
	// contains filtered or unexported methods
}

#[serde(tag = "kind", rename_all = "lowercase")]

pub enum IdlTypeDefTy {
    Struct {
        #[serde(skip_serializing_if = "is_default")]
        fields: Option<IdlDefinedFields>,
    },
    Enum {
        variants: Vec<IdlEnumVariant>,
    },
    Type {
        alias: IdlType,
    },
}

type IdlTypeDefTyEnum

type IdlTypeDefTyEnum struct {
	//	    pub kind: String,
	Kind string `json:"kind"`
	//	    pub variants: Vec<IdlEnumVariant>,
	Variants VariantSlice `json:"variants"`
}

func (IdlTypeDefTyEnum) IsAllSimple

func (obj IdlTypeDefTyEnum) IsAllSimple() bool

func (IdlTypeDefTyEnum) MarshalJSON

func (et IdlTypeDefTyEnum) MarshalJSON() ([]byte, error)

func (*IdlTypeDefTyEnum) UnmarshalJSON

func (et *IdlTypeDefTyEnum) UnmarshalJSON(data []byte) error

type IdlTypeDefTyStruct

type IdlTypeDefTyStruct struct {
	//	    pub kind: String,
	Kind string `json:"kind"`
	//	    #[serde(skip_serializing_if = "is_default")]
	//	    pub fields: Option<IdlDefinedFields>,
	Fields IdlDefinedFields `json:"fields,omitzero"`
}

func (IdlTypeDefTyStruct) MarshalJSON

func (st IdlTypeDefTyStruct) MarshalJSON() ([]byte, error)

func (*IdlTypeDefTyStruct) UnmarshalJSON

func (st *IdlTypeDefTyStruct) UnmarshalJSON(data []byte) error

type Option

type Option[T any] struct {
	// contains filtered or unexported fields
}

Option marshals to null if the value is nil, otherwise it marshals to the value.

func None

func None[T any]() Option[T]

func Some

func Some[T any](value T) Option[T]

func (Option[T]) IsNone

func (o Option[T]) IsNone() bool

func (Option[T]) IsSome

func (o Option[T]) IsSome() bool

func (Option[T]) MarshalJSON

func (o Option[T]) MarshalJSON() ([]byte, error)

func (*Option[T]) UnmarshalJSON

func (o *Option[T]) UnmarshalJSON(data []byte) error

func (Option[T]) Unwrap

func (o Option[T]) Unwrap() T

func (Option[T]) UnwrapOr

func (o Option[T]) UnwrapOr(defaultValue T) T

func (Option[T]) UnwrapOrElse

func (o Option[T]) UnwrapOrElse(f func() T) T

type OptionSkip

type OptionSkip[T any] struct {
	// contains filtered or unexported fields
}

OptionSkip is a variant of Option that skips serialization if the value is nil.

func NoneSkip

func NoneSkip[T any]() OptionSkip[T]

func SomeSkip

func SomeSkip[T any](value T) OptionSkip[T]

func (OptionSkip[T]) IsNone

func (o OptionSkip[T]) IsNone() bool

func (OptionSkip[T]) IsSome

func (o OptionSkip[T]) IsSome() bool

func (OptionSkip[T]) MarshalJSON

func (o OptionSkip[T]) MarshalJSON() ([]byte, error)

func (OptionSkip[T]) Unwrap

func (o OptionSkip[T]) Unwrap() T

func (OptionSkip[T]) UnwrapOr

func (o OptionSkip[T]) UnwrapOr(defaultValue T) T

func (OptionSkip[T]) UnwrapOrElse

func (o OptionSkip[T]) UnwrapOrElse(f func() T) T

type Strings

type Strings []string

func (*Strings) AddUnique

func (s *Strings) AddUnique(str string)

AddUnique adds a string to the slice if it is not already present.

func (Strings) Clone

func (s Strings) Clone() Strings

Clone creates a new Strings with the same elements as the original.

func (Strings) Duplicates

func (s Strings) Duplicates() Strings

func (Strings) Equal

func (s Strings) Equal(other Strings) bool

Equal checks if two Strings are equal, meaning they contain the same elements regardless of order.

func (Strings) Has

func (s Strings) Has(str string) bool

Has checks if the string is in the slice.

func (Strings) In

func (a Strings) In(b Strings) Strings

In returns a new Strings containing elements that are in both `a` and `b`. For example, if a = ["a", "b", "c"] and b = ["b", "c", "d"], then a.In(b) will return ["b", "c"]. If `b` is nil, it returns an empty Strings. If `a` is nil, it returns an empty Strings. If both are nil, it returns an empty Strings.

func (Strings) Len

func (s Strings) Len() int

func (Strings) NotIn

func (a Strings) NotIn(b Strings) Strings

NotIn returns a new Strings containing elements from `a` that are not in `b`. It is the opposite of In. For example, if a = ["a", "b", "c"] and b = ["b", "c"], then a.NotIn(b) will return ["a"]. If `b` is nil, it returns a clone of `a`. If `a` is nil, it returns an empty Strings. If both are nil, it returns an empty Strings.

func (*Strings) Push

func (s *Strings) Push(str ...string)

Push adds one or more strings to the slice regardless of whether it is already present.

func (*Strings) Sort

func (s *Strings) Sort() *Strings

Sort sorts the slice of strings.

func (Strings) String

func (s Strings) String() string

func (Strings) Unique

func (s Strings) Unique() Strings

type ValidationErrors

type ValidationErrors struct {
	NotResolvedTypes          Strings
	InvalidTypeNames          Strings
	DuplicateDefinedTypeNames Strings
	OtherErrors               []error // You can add more error types if needed.
}

func ValidateIDL

func ValidateIDL(idl *Idl) *ValidationErrors

func (*ValidationErrors) AddDuplicateDefinedTypeName

func (v *ValidationErrors) AddDuplicateDefinedTypeName(name string)

func (*ValidationErrors) AddInvalidTypeName

func (v *ValidationErrors) AddInvalidTypeName(name string)

func (*ValidationErrors) AddNotResolvedType

func (v *ValidationErrors) AddNotResolvedType(name string)

func (*ValidationErrors) AddOtherError

func (v *ValidationErrors) AddOtherError(err error)

AddOtherError adds an error to the OtherErrors slice.

func (*ValidationErrors) Error

func (v *ValidationErrors) Error() string

func (ValidationErrors) HasErrors

func (v ValidationErrors) HasErrors() bool

func (*ValidationErrors) IsNil

func (v *ValidationErrors) IsNil() bool

type VariantSlice

type VariantSlice []IdlEnumVariant

func (VariantSlice) IsAllSimple

func (sl VariantSlice) IsAllSimple() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL