{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "%load_ext rust_magic" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Deps can be separated into separate cells:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Deps: time = \"0.1.42\"\n" ] } ], "source": [ "%rust_deps time = \"0.1.42\"" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Updating crates.io index\n", " Compiling winapi v0.3.8\n", " Compiling time v0.1.42\n", " Compiling cell v0.1.0 (C:\\Users\\ASUS\\AppData\\Local\\Cargo\\script-cache\\file-cell-732c7979eb7da673)\n", " Finished release [optimized] target(s) in 18.28s\n", "\"Sat, 31 Aug 2019 03:29:54 +0700\"\n" ] } ], "source": [ "%rust time::now().rfc822z().to_string()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Items too long to fit into a line can be put into a cell: " ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Deps: time = \"0.1.42\"; ndarray = {git = \"https://github.com/rust-ndarray/ndarray.git\"}\n" ] } ], "source": [ "%%rust_deps\n", "time = \"0.1.42\"\n", "ndarray = {git = \"https://github.com/rust-ndarray/ndarray.git\"}" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(\"Mon, 26 Aug 2019 17:12:58 +0700\", 6.0)\n" ] } ], "source": [ "%%rust\n", "(time::now().rfc822z().to_string(), \n", " ndarray::Array::from_vec(vec![1., 2., 3.]).sum())" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Deps: time = \"0.1.42\"; ndarray = \"0.12.1\"\n" ] } ], "source": [ "%rust_deps" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Deps: \n" ] } ], "source": [ "%rust_deps --clear" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }