John Smith
john@example.com
#[cfg(test)]
mod test_examples_show {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn serial_test_example_show0() {
let user_agent = concat!(env!("CARGO_PKG_NAME"), ".rs/", env!("CARGO_PKG_VERSION"),);
let http_client = reqwest::Client::builder()
.user_agent(user_agent)
.timeout(std::time::Duration::from_secs(600))
.connect_timeout(std::time::Duration::from_secs(60));
let ws_client = reqwest::Client::builder()
.connect_timeout(std::time::Duration::from_secs(60))
.connection_verbose(true)
.tcp_keepalive(std::time::Duration::from_secs(600))
.http1_only();
let token = std::env::var("KITTYCAD_API_TOKEN").expect("KITTYCAD_API_TOKEN not set");
let client = kittycad::Client::new_from_reqwest(token, http_client, ws_client);
let ws = client
.modeling()
.commands_ws(None, None, None, None, None, Some(false))
.await
.unwrap();
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nshow");
let parser = crate::parser::Parser::new(tokens);
let program = parser.ast().unwrap();
let mut mem: crate::executor::ProgramMemory = Default::default();
let ctx = crate::executor::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn::EngineConnection::new(ws)
.unwrap(),
)),
fs: crate::fs::FileManager::new(),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
units: kittycad::types::UnitLength::Mm,
};
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
}
#[allow(non_camel_case_types, missing_docs)]
#[doc = "Std lib function: show\nThis is some function.\nIt does shit."]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, schemars :: JsonSchema, ts_rs :: TS)]
#[ts(export)]
pub(crate) struct Show {}
#[allow(non_upper_case_globals, missing_docs)]
pub(crate) const Show: Show = Show {};
fn boxed_show(
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
>,
> {
Box::pin(show(args))
impl crate::docs::StdLibFn for Show {
fn name(&self) -> String {
"show".to_string()
fn summary(&self) -> String {
"This is some function.".to_string()
fn description(&self) -> String {
"It does shit.".to_string()
fn tags(&self) -> Vec<String> {
vec![]
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
let mut settings = schemars::gen::SchemaSettings::openapi3();
settings.inline_subschemas = true;
let mut generator = schemars::gen::SchemaGenerator::new(settings);
vec![crate::docs::StdLibFnArg {
name: "args".to_string(),
type_: "[number]".to_string(),
schema: <Vec<f64>>::json_schema(&mut generator),
required: true,
}]
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
Some(crate::docs::StdLibFnArg {
name: "".to_string(),
type_: "()".to_string(),
schema: <()>::json_schema(&mut generator),
})
fn unpublished(&self) -> bool {
false
fn deprecated(&self) -> bool {
fn examples(&self) -> Vec<String> {
let code_blocks = vec!["This is code.\nIt does other shit.\nshow"];
code_blocks
.iter()
.map(|cb| {
let tokens = crate::token::lexer(cb);
let mut options: crate::ast::types::FormatOptions = Default::default();
options.insert_final_newline = false;
program.recast(&options, 0)
.collect::<Vec<String>>()
fn std_lib_fn(&self) -> crate::std::StdFn {
boxed_show
fn clone_box(&self) -> Box<dyn crate::docs::StdLibFn> {
Box::new(self.clone())
#[doc = r" This is some function."]
#[doc = r" It does shit."]
#[doc = r""]
#[doc = r" This is code."]
#[doc = r" It does other shit."]
#[doc = r" show"]
fn inner_show(#[doc = r" The args to do shit to."] _args: Vec<f64>) {}