pub struct LuaWriter<W: Write> { /* private fields */ }Expand description
An Nsi sink that writes each call straight to a Lua script.
The Lua twin of crate::StreamWriter, and the writing half of a
filter whose output is a script rather than a stream. Every
restriction write_lua documents applies here and for the same
reason: the binding is narrower than the C API, so a call it cannot
say is refused rather than emitted as something else.
let writer = LuaWriter::new(Vec::new());
writer.create("cam", "perspectivecamera", None).unwrap();
assert_eq!(
String::from_utf8(writer.into_inner()).unwrap(),
"nsi.Create(\"cam\", \"perspectivecamera\")\n",
);Implementations§
Trait Implementations§
Source§impl<W: Write + Send> Nsi for LuaWriter<W>
impl<W: Write + Send> Nsi for LuaWriter<W>
Source§fn create(
&self,
handle: &str,
node_type: &str,
args: Option<&[Self::Arg<'_>]>,
) -> Result<(), Self::Error>
fn create( &self, handle: &str, node_type: &str, args: Option<&[Self::Arg<'_>]>, ) -> Result<(), Self::Error>
§Errors
LuaError::CreateArguments when the create carries
parameters: nsi.Create has nowhere to put them.
Source§fn render_control(
&self,
action: Action,
args: Option<&[Self::Arg<'_>]>,
) -> Result<(), Self::Error>
fn render_control( &self, action: Action, args: Option<&[Self::Arg<'_>]>, ) -> Result<(), Self::Error>
The action is written as the "action" parameter ɴsɪ’s Lua
binding reads, and one that arrived in args is dropped –
crate::StreamWriter::render_control says why.
Source§type Arg<'call> = Arg<'call, 'static>
type Arg<'call> = Arg<'call, 'static>
Argument type – each implementor picks its own. Read more
Source§fn delete(
&self,
handle: &str,
args: Option<&[Self::Arg<'_>]>,
) -> Result<(), Self::Error>
fn delete( &self, handle: &str, args: Option<&[Self::Arg<'_>]>, ) -> Result<(), Self::Error>
Delete a node from the scene graph.
Source§fn set_attribute(
&self,
handle: &str,
args: &[Self::Arg<'_>],
) -> Result<(), Self::Error>
fn set_attribute( &self, handle: &str, args: &[Self::Arg<'_>], ) -> Result<(), Self::Error>
Set attributes on a node.
Source§fn set_attribute_at_time(
&self,
handle: &str,
time: f64,
args: &[Self::Arg<'_>],
) -> Result<(), Self::Error>
fn set_attribute_at_time( &self, handle: &str, time: f64, args: &[Self::Arg<'_>], ) -> Result<(), Self::Error>
Set attributes on a node at a specific time (for motion blur).
Source§fn delete_attribute(&self, handle: &str, name: &str) -> Result<(), Self::Error>
fn delete_attribute(&self, handle: &str, name: &str) -> Result<(), Self::Error>
Delete an attribute from a node.
Source§fn connect(
&self,
from: &str,
from_attribute: Option<&str>,
to: &str,
to_attribute: &str,
args: Option<&[Self::Arg<'_>]>,
) -> Result<(), Self::Error>
fn connect( &self, from: &str, from_attribute: Option<&str>, to: &str, to_attribute: &str, args: Option<&[Self::Arg<'_>]>, ) -> Result<(), Self::Error>
Connect two nodes in the scene graph.
Auto Trait Implementations§
impl<W> !Freeze for LuaWriter<W>
impl<W> !RefUnwindSafe for LuaWriter<W>
impl<W> Send for LuaWriter<W>
impl<W> Sync for LuaWriter<W>
impl<W> Unpin for LuaWriter<W>
impl<W> UnsafeUnpin for LuaWriter<W>
impl<W> UnwindSafe for LuaWriter<W>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more