Crate dsdl_parser [] [src]

A parser for the DSDL (Data structure description language) used in uavcan

For full description have a look at the specification

Examples

Parse DSDL directory

use dsdl_parser::DSDL;

assert!(DSDL::read("tests/dsdl/").is_ok());

Parse single file

use dsdl_parser::DSDL;
 
assert!(DSDL::read("tests/dsdl/uavcan/protocol/341.NodeStatus.uavcan").is_ok());
 

Display a file

use dsdl_parser::DSDL;

let dsdl = DSDL::read("./tests/dsdl/").unwrap();

println!("{}", dsdl.get_file("uavcan.protocol.GetNodeInfo").unwrap());
 

Calculate data type signature

use dsdl_parser::DSDL;

let dsdl = DSDL::read("./tests/dsdl/").unwrap();

assert_eq!(dsdl.data_type_signature("uavcan.protocol.GetNodeInfo").unwrap(), 0xee468a8121c46a9e);

Structs

Comment

A comment

CompositeType

A CompositeType is what the uavcan specification refers to as "Nested data structures"

ConstDefinition

A constant definition

DSDL

The DSDL struct contains a number of data type definition

FieldDefinition

A Field definition

File

A DSDL file

FileName

Uniquely defines a DSDL file

Ident

An Identifier (name)

MessageDefinition

An Uavcan message definition

NormalizedFile

A normalized File

ServiceDefinition

An Uavcan service definition

Size

Used to determin size of e.g. DynamicArray or a StaticArray

Version

A dsdl file version

Enums

ArrayInfo

Uavcan array information

AttributeDefinition

An attribute definition is either a FieldDefintion or a ConstDefinition

CastMode

Cast mode defines the rules of conversion from the native value of a certain programming language to the serialized field value.

Const

A constant must be a primitive scalar type (i.e., arrays and nested data structures are not allowed as constant types).

Directive

An Uavcan Directive

Line

A Line in a DSDL File

ParseCastModeError
ParseDirectiveError
ParseFileNameError
ParsePrimitiveTypeError
PrimitiveType

An Uavcan PrimitiveDataType

Ty

An Uavcan data type

TypeDefinition

A DSDL type definition.