You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
prost supports no_std mode but does it also support no alloc mode i.e stack based allocation for bare meta rust?
i see one repo built on prost(https://github.com/dflemstr/femtopb) that support no_std and no_alloc but wondering if prost support this mode or not?
Where is memory getting allocated for the prost::alloc::vec::Vec?
using prost::alloc::vec::Vec;
let mut triangles = Vec::new();
my proto is
message Vector3 {
float x = 1;
float y = 2;
float z = 3;
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
prost supports no_std mode but does it also support no alloc mode i.e stack based allocation for bare meta rust?
i see one repo built on prost(https://github.com/dflemstr/femtopb) that support no_std and no_alloc but wondering if prost support this mode or not?
Where is memory getting allocated for the prost::alloc::vec::Vec?
using prost::alloc::vec::Vec;
let mut triangles = Vec::new();
my proto is
message Vector3 {
float x = 1;
float y = 2;
float z = 3;
}
message Triangle {
Vector3 v0 = 1;
Vector3 v1 = 2;
Vector3 v2 = 3;
Vector3 normal = 4;
}
message Mesh {
repeated Triangle triangles = 1;
}
my code
let mut triangles = Vec::new();
let vec0: Option = Some(Vector3 {
x: 1.0,
y: 1.1,
z: 1.2,
..Default::default()
});
let vec1: Option = Some(Vector3 {
x: 1.0,
y: 1.1,
z: 1.2,
..Default::default()
});
let vec2: Option = Some(Vector3 {
x: 1.0,
y: 1.1,
z: 1.2,
..Default::default()
});
let normal: Option = Some(Vector3 {
x: 1.0,
y: 1.1,
z: 1.2,
..Default::default()
});
let triangle = Triangle {
v0: vec0,
v1: vec1,
v2: vec2,
normal,
..Default::default()
};
triangles.push(triangle);
let mesh = Mesh {
triangles,
..Default::default()
}
let mut bytes = [0u8; 256];
let mut buf = &mut bytes[..];
mesh.encode(&mut buf).unwrap();
Beta Was this translation helpful? Give feedback.
All reactions