blob: 5886c28763c87c797d76f96762eab2e4eb6ba357 [file] [log] [blame]
// Copyright 2022 The Pigweed Authors
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
#[cfg(feature = "python")]
mod py;
pub fn name() -> &'static str {
#[cfg(feature = "python")]
pub fn py_demo(code: &str) {
use py::Py;
let mut py = Py::new();
let py_result =
// Scope initialization function.
|vm, scope| {
// Add a `rust_print` function to the scope before running the code.
.new_function("rust_print", |s: String| println!("[R] {}", s))
if let Err(e) = py_result {
// Placeholder until qg has an error type
println!("py_demo error: {:?}", e);
mod tests {
use super::*;
fn it_works() {
assert_eq!(name(), "qg");