Skip to content

Instantly share code, notes, and snippets.

View kabergstrom's full-sized avatar

Karl Bergström kabergstrom

  • Gothenburg, Sweden
View GitHub Profile
error[E0277]: the trait bound `element::ElementID: FromReflect` is not satisfied
--> element.rs:1416:17
|
1416 | #[derive(Clone, Reflect, Serialize, Deserialize)]
| ^^^^^^^ the trait `FromReflect` is not implemented for `element::ElementID`
|
= help: the following other types implement trait `FromReflect`:
()
(A, B)
impl ImportOp {
pub async fn fetch_kv(path: &Path, key: &str) -> Result<Vec<u8>> {
// like fetch_import_artifacts, except it fetches arbitrary key-value data
}
/// Store data with a named key
pub async fn store_kv(key: &str, data: Vec<u8>) {}
pub async fn fetch_import_artifact(
use crate::experimental::{Loader, DefaultLoader};
use amethyst_error::Error;
use amethyst_core::{
ecs::prelude::{Component, RunNow, DispatcherBuilder, World, WorldExt},
SystemBundle, SystemDesc,
};
struct LoaderSystem;
impl<'a> RunNow<'a> for LoaderSystem {
fn setup(&mut self, _world: &mut World) {
@kabergstrom
kabergstrom / executor.rs
Created June 3, 2019 22:39
single threaded executor
use std::future::*;
use std::pin::Pin;
use std::ptr::NonNull;
use std::rc::Rc;
use std::task::*;
struct FatPtrData<T: ?Sized> {
vtable_ptr: usize,
is_waking: bool,
value: T,
error: internal compiler error: src\librustc\traits\codegen\mod.rs:58: Encountered error `OutputTypeParameterMismatch(Binder(<[closure@DefId(108/1:75 ~ atelier_loader[5f28]::rpc_loader[0]::process_metadata_requests[0]::{{closure}}[0]) 0:&mut &mut std::collections::HashMap<[u8; 16], atelier_loader::rpc_loader::AssetMetadata>, 1:&&mut std::collections::HashMap<[u8; 16], atelier_loader::loader::LoadHandle>,
2:&mut &mut slotmap::normal::SlotMap<atelier_loader::loader::LoadHandle, atelier_loader::rpc_loader::AssetStatus<()>>] as std::ops::FnMut<(std::result::Result<<schema::service_capnp::asset_hub::snapshot::get_asset_metadata_with_dependencies_results::Owned as capnp::traits::Owned<'_>>::Reader, std::boxed::Box<dyn std::error::Error>>, &mut std::vec::Vec<([u8; 16], atelier_loader::loader::LoadHandle)>)>>), Binder(<[closure@DefId(108/1:75 ~ atelier_loader[5f28]::rpc_loader[0]::process_metadata_requests[0]::{{closure}}[0]) 0:&mut &mut std::collections::HashMap<[u8; 16], atelier_loader::rpc_loader::AssetMetadata>,
@kabergstrom
kabergstrom / encoder.rs
Last active January 2, 2019 19:12
Encoder API example
trait Renderer<'a> {
/// Takes a pipeline, an ordered list of field descriptors and returns pointers into mapped GPU buffers for each field.
fn pipeline_outputs(
&mut self,
pipeline: Handle<Pipeline>,
fields: &[FieldDesc],
entity_offset: u32,
) -> &'a [EncodeTarget];
}
int[] chnumbers = new int[10];
for (int i = 0; i < chnumbers.Length; i++)
{
Console.Write("Mata in en siffra:");
chnumbers[i] = Convert.ToInt32(Console.ReadLine());
}
{
Console.WriteLine("Alla siffror med for loop");
for (int i = 0; i < chnumbers.Length; i++)
@kabergstrom
kabergstrom / gist:7334198
Created November 6, 2013 10:53
Building with Visual Studio 2012 for .NET 4.0 x86 in release mode, the results differ between running on Microsoft's .NET and mono 3.3.0 (master/6cd4ddc) on Windows with an i7 3820 If a Console.WriteLine call is inserted after the Math.Atan2 call, printing direction, the results no longer differ.
using System;
using System.Runtime.InteropServices;
namespace floattest
{
class Program
{
static void Main(string[] args)
{
float currentX = -0.91290748f;
float currentY = 0.408166558f;