profile
viewpoint
Paul Woolcock pwoolcoc Michigan http://pwoolcoc.gitlab.io Software Developer who loves writing Rust

Aardwolf-Social/aardwolf 346

Powering connected social communities with open software.

pwoolcoc/crafting-interpreters-rust 21

Following along with http://www.craftinginterpreters.com, except in Rust

pwoolcoc/dat-rs 19

rust implementation of the DAT protocol

pwoolcoc/cargo-do 17

allows you to run multiple cargo commands in a row

pwoolcoc/cargo-template 6

create cargo projects from existing templates

pwoolcoc/bitbucket-server-scripts 3

various scripts for extracting data from a bitbucket server

pwoolcoc/crates-ro 2

Read-only, static, js-free version of crates.io

pwoolcoc/aoc17 1

Advent of Code 2017

pwoolcoc/aoc2018 1

Advent of Code 2018

issue commentlocalstack/localstack

Small deviation in SQS implementation

@whummer looks like it's just being html-encoded:

<?xml version="1.0"?>
<ReceiveMessageResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/">
    <ReceiveMessageResult>
        <Message>
            <MessageId>...</MessageId>
            <ReceiptHandle>...</ReceiptHandle>
            <MD5OfBody>...</MD5OfBody>
            <MD5OfMessageAttributes>...</MD5OfMessageAttributes>
            <Body>foobar</Body>
            <MessageAttribute>
                <Name>Summary</Name>
                <Value>
                    <StringValue>&lt;h1&gt;foo&lt;/h1&gt;</StringValue>             <!-- THIS WAS SENT AS "<h1>foo</h1>" -->
                   <DataType>String</DataType>
                </Value>
            </MessageAttribute>
        </Message>
    </ReceiveMessageResult>
    <ResponseMetadata>
        <RequestId>...</RequestId>
    </ResponseMetadata>
</ReceiveMessageResponse>
pwoolcoc

comment created time in 6 days

issue commentlocalstack/localstack

Small deviation in SQS implementation

@whummer I'll try to get you this info today

pwoolcoc

comment created time in 6 days

issue openedlocalstack/localstack

Small deviation in SQS implementation

<!-- Love localstack? Please consider supporting our collective: 👉 https://opencollective.com/localstack/donate -->

Type of request: This is a ...

[x] bug report [ ] feature request

Detailed description

In the ReceiveMessageResult of the SQS service, I saw this XML from localstack:

...
<MessageAttribute>
     <Name>encoding</Name>
    <Value>
        <DataType>String</DataType>
        <StringValue><![CDATA[gzip]]></StringValue>
    </Value>
</MessageAttribute>
...

The <![CDATA[gzip]]> is slightly different from AWS, which doesn't wrap the value in a <!CDATA[[]]> section. This shouldn't be a problem for XML parsers that accept both plain characters and CDATA sections for this element, but the XML parser I was using did not, which causes an error when running the code against localstack but not when running the code against AWS. There is obviously a bug in the XML parser as well, but I thought that I should at least post this here since it is different than what AWS SQS does.

Expected behavior

MessageAttribute::Value elements should not be wrapped in CDATA sections.

Actual behavior

MessageAttribute::Value elements all seem to be wrapped in CDATA sections.

Steps to reproduce

Send a message to the SQS service which contains some custom message attributes, then make a ReceiveMessageRequest.

Command used to start LocalStack

docker run --env "SERVICES=sqs" localstack/localstack

Client code (AWS SDK code snippet, or sequence of "awslocal" commands)

...

created time in 9 days

push eventpwoolcoc/rusoto

Paul Woolcock

commit sha 89c855d425a0824a41807f01daf82c0c4fef4a9f

`characters` should treat CData sections as strings Currently if a plain string is wrapped in `<![CDATA[]]>`, rusoto will throw an `Expected characers` error, when it should be handling CDATA like any other string

view details

push time in 9 days

PR opened rusoto/rusoto

`xml::utils::characters` should treat CData sections as strings

Currently if a plain string is wrapped in <![CDATA[]]>, rusoto will throw an Expected characters error, when it should be handling CDATA like any other string

Closes #1777

+7 -5

0 comment

2 changed files

pr created time in 9 days

push eventpwoolcoc/rusoto

Paul Woolcock

commit sha 51ac40b9fd88916ff5fb60f4505834e4d140d7fb

`characters` should treat CData sections as strings Currently if a plain string is wrapped in `<![CDATA[]]>`, rusoto will throw an `Expected characers` error, when it should be handling CDATA like any other string

view details

push time in 9 days

create barnchpwoolcoc/rusoto

branch : characters-should-handle-characters-or-data

created branch time in 9 days

fork pwoolcoc/rusoto

AWS SDK for Rust

fork in 9 days

issue openedrusoto/rusoto

"Expected characters" error when string value is wrapped in a CData

I have this in as SQS ReceiveMessageResult response:

<MessageAttribute>
     <Name>encoding</Name>
    <Value>
        <DataType>String</DataType>
        <StringValue><![CDATA[gzip]]></StringValue>
    </Value>
</MessageAttribute>

rusoto is throwing an "Expected characters" response when it gets to the StringValue because the XML event it's expecting is Characters and it's get a CData.

This response came from localstack's SQS implementation, so it's a bug on localstack's part too, but I personally think that rusoto should handle this successfully instead of throwing a parse error.

I'm drafting a PR to fix this, which should be open momentarily.

created time in 9 days

issue commentdtolnay/serde-yaml

hint to deserialize number as a string instead?

@dtolnay any chance you could take a look at this?

pwoolcoc

comment created time in 9 days

issue commentrusoto/rusoto

Expected characters error when response content with empty element

I'm getting this error when using rusoto_sqs==0.44.0, but I'm having a hard time getting access to the underlying XML. Here's the response that the aws-cli shows me in JSON:

{
    "Messages": [
        {
            "MessageId": "681972bf-d96a-e1c4-5a01-a628ece7052d",
            "ReceiptHandle": "tsaoospcqwdifiwglaanvgcfrbzktmadaohuepvyrdgombqsnqqdpfcsfocwhqrybovbdkfkzhssxqikxjzkgxicptclwojhyzgxenfxjpzsrxaizudtllnctmdetnbsfjibxxujutpxkelsuvxjopqrfxhpradsosmvwlbuhsornfofoaogerwhn",
            "MD5OfBody": "6f236cdb9e7aa81ffee095dde92e6dda",
            "Body": "H4sIAAAAAAAA/zXNQQrDIBCF4bu47oAy0dFcpsyYsYSAXTibEnL3RmhXPzz4eKez96Hdrb8+3Kjcn/t2L6XFQooMXIhhQVFgFoGaaqCENaZQ/+DQzy18Dlx0i+ALIiyZPEhrBCxZxXuNSHEKNdv7a7j1dKbD5vvMdX0BzScItI8AAAA=",
            "Attributes": {
                "SenderId": "AIDAIT2UOQQY3AUEKVGXU",
                "SentTimestamp": "1593116374401",
                "ApproximateReceiveCount": "1",
                "ApproximateFirstReceiveTimestamp": "1593116388319"
            },
            "MD5OfMessageAttributes": "3333423f1f9fa2a8aacf45b0ca5f7443",
            "MessageAttributes": {
                "encoding": {
                    "StringValue": "gzip",
                    "DataType": "String"
                }
            }
        }
    ]
}
jarod

comment created time in 10 days

issue commentdtolnay/async-trait

Feature Request: Decorator for methods for local macro-generated methods

@taiki-e thanks, I'll give that a try

pwoolcoc

comment created time in 12 days

issue openeddtolnay/async-trait

Feature Request: Decorator for methods for local macro-generated methods

I have a trait in an existing crate of mine that I'm trying to convert to an async-trait, but am running into a problem with the order in which proc macros and macro_rules macros are run. My code currently generates some methods for the trait impl using macros, like such:

macro_rules! generate_foo {
    () => {
        fn foo() {}
    }
}

trait Foo {
    fn foo();
}

struct Bar;

impl Foo for Bar {
    generate_foo!();
}

When I change foo to async fn foo in the trait, I get an issue because the async_trait proc macro runs before the generate_foo macro is expanded, so I end up with generated code like this:

#![feature(prelude_import)]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate std;
use async_trait::async_trait;

macro_rules! generate_foo { () => { async fn foo() { } } }

trait Foo {
    #[must_use]
    fn foo<'async_trait>()
    ->
        ::core::pin::Pin<Box<dyn ::core::future::Future<Output = ()> +
                             ::core::marker::Send + 'async_trait>>;
}

struct Bar;

impl Foo for Bar {
    async fn foo() { }
}

I understand why this is happening and don't consider it a bug that async_trait needs to, or even could, fix, but I was wondering if there could be an attribute to put on methods that could perform the code generation? I.e., I could do something like the following:

macro_rules! generate_foo {
    () => {
        #[async_trait::async_method]
        async fn foo() { }
    }
}

struct Bar;

impl Foo for Bar {
    generate_foo!();
}

I would be willing to work on this feature, but I figured I would check and see if this was something useful to others.

created time in 13 days

issue commentsoftprops/openapi

Unable to deser the "Basic Structure" example from the OpenAPI v2 spec

I think this is related to this serde_yaml issue, if so I will close this: https://github.com/dtolnay/serde-yaml/issues/165

pwoolcoc

comment created time in 20 days

issue commentdtolnay/serde-yaml

hint to deserialize number as a string instead?

@dtolnay sorry for the long wait, it took me a bit of debugging to get my complex example down to a minimal reproducible case. It looks like this problem only happens when an untagged enum is involved. Here's the code:

use std::{
    collections::BTreeMap,
    io::Cursor,
};
use serde_yaml;
use serde::Deserialize;

fn main() {
    const Y: &str = "
foos:
    bar: 42
    baz: 123
    200: 321";
    
    const Z: &str = "
foos:
    'bar': 42
    'baz': 123
    '200': 321";

    // This successfully deserializes
    let foo: Foo = serde_yaml::from_str(&mut Y).expect("Couldn't deserialize");

    // However, when wrapped in an untagged enum, it does not:
    // 
    // swap these two lines to see that the "Z" document successfully deserializes,
    // while the "Y" document does not
    let foo: Wrapper = serde_yaml::from_str(&mut Y).expect("Couldn't deserialize");
    //let foo: Wrapper = serde_yaml::from_str(&mut Z).expect("Couldn't deserialize");
}

#[derive(Debug, Deserialize, PartialEq)]
#[serde(untagged)]
enum Wrapper {
  Foo(Foo),
}

#[derive(Debug, Deserialize, PartialEq)]
struct Foo {
  foos: BTreeMap<String, usize>,
}
pwoolcoc

comment created time in 20 days

issue openeddtolnay/serde-yaml

hint to deserialize number as a string instead?

I have a data structure like this:

struct Foo {
    // ...
    foos: BTreeMap<String, usize>,
    // ...
}

And sometimes, the keys for that map can be numbers, but I'd like them deserialized as strings like the other keys.

For example:

foo:
    foos:
        bar: 42
        baz: 123
        200: 321

I'd like to end up with

BTreeMap(
    "bar" => 42,
    "baz" => 123,
    "200" => 321,
)

but instead I, understandably, get a deserialization erorr since 200 is a number.

Is there any way to hint to serde_yaml that the 200 should be deserialized as a string, or do I need to make a new type that performs these conversions in it's Deserialize impl?

created time in 24 days

delete branch pwoolcoc/elefren

delete branch : update-to-2018-edition

delete time in 24 days

delete branch pwoolcoc/elefren

delete branch : dependabot/cargo/pretty_env_logger-0.4.0

delete time in 24 days

push eventpwoolcoc/elefren

dependabot-preview[bot]

commit sha 5b4be01eee9611c20782f7cdbad2a30afa323696

Update pretty_env_logger requirement from 0.3.0 to 0.4.0 Updates the requirements on [pretty_env_logger](https://github.com/seanmonstar/pretty-env-logger) to permit the latest version. - [Release notes](https://github.com/seanmonstar/pretty-env-logger/releases) - [Commits](https://github.com/seanmonstar/pretty-env-logger/compare/v0.3.0...v0.4.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

view details

push time in 24 days

PR merged pwoolcoc/elefren

Update pretty_env_logger requirement from 0.3.0 to 0.4.0 dependencies

Updates the requirements on pretty_env_logger to permit the latest version. <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/seanmonstar/pretty-env-logger/commit/fa4e28537f153a20e655349556ec982e3657a848"><code>fa4e285</code></a> v0.4.0</li> <li><a href="https://github.com/seanmonstar/pretty-env-logger/commit/693b5e70880ada9fcca6c10766f5c55f656980e8"><code>693b5e7</code></a> Remove chrono dependency</li> <li><a href="https://github.com/seanmonstar/pretty-env-logger/commit/28c5ad0cbbc206b661f1e35784fc2a2d2d11a9ed"><code>28c5ad0</code></a> env_logger: 0.6.2 -> 0.7.0</li> <li><a href="https://github.com/seanmonstar/pretty-env-logger/commit/0288e4ed4b730239c401b46b78b818fa3875171b"><code>0288e4e</code></a> fixes env goof in README.md</li> <li><a href="https://github.com/seanmonstar/pretty-env-logger/commit/76d9fc760608eff42bbf7deb77ad2cab2cd1172e"><code>76d9fc7</code></a> Make env_logger dependency public</li> <li><a href="https://github.com/seanmonstar/pretty-env-logger/commit/8ddffae2c556108640af9d4faf95d51f773f2623"><code>8ddffae</code></a> v0.3.1</li> <li><a href="https://github.com/seanmonstar/pretty-env-logger/commit/04c1aa50e1f07fa2be33ea6866c05e39a073f015"><code>04c1aa5</code></a> require latest env_logger</li> <li><a href="https://github.com/seanmonstar/pretty-env-logger/commit/ce8c2f12fb72f634f8467f2e5e4fc4a19edafa7c"><code>ce8c2f1</code></a> fix deprecated calls</li> <li><a href="https://github.com/seanmonstar/pretty-env-logger/commit/67d2e7d68b3449229c4876bb0813bed50d65b207"><code>67d2e7d</code></a> timestamps with milliseconds</li> <li><a href="https://github.com/seanmonstar/pretty-env-logger/commit/27eaa2bc1bb666b0888027c106d00cc0ab50d2bc"><code>27eaa2b</code></a> fix with_builder_1 example (<a href="https://github-redirect.dependabot.com/seanmonstar/pretty-env-logger/issues/25">#25</a>)</li> <li>See full diff in <a href="https://github.com/seanmonstar/pretty-env-logger/compare/v0.3.0...v0.4.0">compare view</a></li> </ul> </details> <br />

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


<details> <summary>Dependabot commands and options</summary> <br />

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
  • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot dashboard:

  • Update frequency (including time of day and day of week)
  • Pull request limits (per update run and/or open at any time)
  • Automerge options (never/patch/minor, and dev/runtime dependencies)
  • Out-of-range updates (receive only lockfile updates, if desired)
  • Security updates (receive only security updates, if desired)

</details>

+1 -1

2 comments

1 changed file

dependabot-preview[bot]

pr closed time in 24 days

delete branch pwoolcoc/elefren

delete branch : dependabot/cargo/serde_qs-0.6.0

delete time in 24 days

push eventpwoolcoc/elefren

dependabot-preview[bot]

commit sha ea8e67e25ba36c70f66ccea2d1ad363184d30990

Update serde_qs requirement from 0.4.5 to 0.6.0 Updates the requirements on [serde_qs](https://github.com/samscott89/serde_qs) to permit the latest version. - [Release notes](https://github.com/samscott89/serde_qs/releases) - [Commits](https://github.com/samscott89/serde_qs/commits) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

view details

push time in 24 days

PR merged pwoolcoc/elefren

Update serde_qs requirement from 0.4.5 to 0.6.0 dependencies

Updates the requirements on serde_qs to permit the latest version. <details> <summary>Commits</summary> <ul> <li>See full diff in <a href="https://github.com/samscott89/serde_qs/commits">compare view</a></li> </ul> </details> <br />

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


<details> <summary>Dependabot commands and options</summary> <br />

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
  • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot dashboard:

  • Update frequency (including time of day and day of week)
  • Pull request limits (per update run and/or open at any time)
  • Automerge options (never/patch/minor, and dev/runtime dependencies)
  • Out-of-range updates (receive only lockfile updates, if desired)
  • Security updates (receive only security updates, if desired)

</details>

+1 -1

1 comment

1 changed file

dependabot-preview[bot]

pr closed time in 24 days

create barnchpwoolcoc/elefren

branch : cargo-diet

created branch time in 24 days

push eventpwoolcoc/elefren

Paul Woolcock

commit sha 16bc060407fc23660994bf3f4894cfecf2a46148

Update to the 2018 edition Only 2 years later :eyeroll:

view details

push time in 24 days

PR merged pwoolcoc/elefren

Update to the 2018 edition

Only 2 years later :eyeroll:

+30247 -88

0 comment

29 changed files

pwoolcoc

pr closed time in 24 days

issue commentwafflespeanut/paperclip

Fails to deserialize sample YAML v2 document

At the end of the day, the document above is a spec-compliant document, as it was taken directly from the spec. All other OpenAPI validators I've run it through have successfully validated it. Only the 2 rust crates I have tried, yours and the openapi crate, have failed to parse it. My use case involves accepting arbitrary OpenAPI documents from my users, so I need to be able to accept any valid OpenAPI spec, and therefore paperclip isn't an option as long as it won't accept all valid OpenAPI specs.

pwoolcoc

comment created time in 25 days

issue commentwafflespeanut/paperclip

Fails to deserialize sample YAML v2 document

exactly, so the 200 should be parsed as a string instead of integer, but it's not, that's where the issue is.

pwoolcoc

comment created time in 25 days

issue commentwafflespeanut/paperclip

Fails to deserialize sample YAML v2 document

ok, but this sample is not from me, but from the official OpenAPIv2 spec...not accepting 200 means paperclip is not spec-compliant.

pwoolcoc

comment created time in 25 days

issue openedsoftprops/openapi

Unable to deser the "Basic Structure" example from the OpenAPI v2 spec

this crate is unable to deserialize the document shown here, in the OpenAPI v2 spec: https://swagger.io/docs/specification/2-0/basic-structure/ . It fails with the following error:

---- test_basic_structure stdout ----
thread 'test_basic_structure' panicked at 'Couldn't deser doc: Yaml(Message("data did not match any variant of untagged enum OpenApi", None))', src/lib.rs:34:15
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Here is the code I used to generate the error:

#[test]
fn test_basic_structure() {
    use std::io::{self, Cursor};

    let doc = r#"swagger: "2.0"
info:
  title: Sample API
  description: API description in Markdown.
  version: 1.0.0

host: api.example.com
basePath: /v1
schemes:
  - https

paths:
  /users:
    get:
      summary: Some text
      description: Some more text
      produces:
        - application/json
      responses:
        200:
          description: OK"#.to_string();

    let bytes = doc.as_bytes().to_vec();
    let mut bytes = Cursor::new(bytes);

    let api = openapi::from_reader(&mut bytes).expect("Couldn't deser doc");
}

I suspect it's the 200: down in the responses: map that is causing the problem, openapi seems to be expecting a String there and it's getting an integer instead

created time in a month

issue openedwafflespeanut/paperclip

Fails to parse sample YAML v2 document

The sample YAML document on this page: https://swagger.io/docs/specification/2-0/basic-structure/ cannot be deserialized by paperclip, it errors out here:

---- test_basic_structure stdout ----
thread 'test_basic_structure' panicked at 'Couldn't deser doc: Yaml(Message("invalid type: integer `200`, expected a string", Some(Pos { marker: Marker { index: 183, line: 14, col: 7 }, path: "paths./users" })))', src/lib.rs:41:45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Here is the code I used to generate this error:

use paperclip::v2::{self, ResolvableApi, DefaultSchema, models::Version};

#[test]
fn test_basic_structure() {
    use std::io::{self, Cursor};

    let doc = r#"swagger: "2.0"
info:
  title: Sample API
  description: API description in Markdown.
  version: 1.0.0

host: api.example.com
basePath: /v1
schemes:
  - https

paths:
  /users:
    get:
      summary: Some text
      description: Some more text
      produces:
        - application/json
      responses:
        200:
          description: OK"#.to_string();

    let bytes = doc.as_bytes().to_vec();
    let mut bytes = Cursor::new(bytes);

    let api: ResolvableApi<DefaultSchema> = v2::from_reader(&mut bytes).expect("Couldn't deser doc");
    assert_eq!(api.swagger, Version::V2);
}

created time in a month

push eventpwoolcoc/elefren

Paul Woolcock

commit sha d5a60a786cee8d4761aa93ef5009e249c5f11ab5

Update to the 2018 edition Only 2 years later :eyeroll:

view details

push time in a month

push eventpwoolcoc/elefren

Paul Woolcock

commit sha 00820254613ea60211bc8e04b4e56b532dece02f

Update to the 2018 edition Only 2 years later :eyeroll:

view details

push time in a month

push eventpwoolcoc/elefren

Paul Woolcock

commit sha 76f65443aad409245e2d3fb987fd7af0707e8bca

Update to the 2018 edition Only 2 years later :eyeroll:

view details

push time in a month

pull request commentpwoolcoc/elefren

Update serde_qs requirement from 0.4.5 to 0.6.0

@dependabot-bot rebase

dependabot-preview[bot]

comment created time in a month

pull request commentpwoolcoc/elefren

Update pretty_env_logger requirement from 0.3.0 to 0.4.0

@dependabot-bot rebase

dependabot-preview[bot]

comment created time in a month

PR opened pwoolcoc/elefren

Update to the 2018 edition

Only 2 years later :eyeroll:

+66 -66

0 comment

23 changed files

pr created time in a month

create barnchpwoolcoc/elefren

branch : update-to-2018-edition

created branch time in a month

created tagpwoolcoc/elefren

tagv0.22.0

It's like Mastodon.py, but for Rust

created time in a month

push eventpwoolcoc/elefren

Paul Woolcock

commit sha 17c727f5c615eed921d0095d1b6f49e44024025d

Update version to 0.22

view details

push time in a month

push eventpwoolcoc/elefren

leo60228

commit sha 791bc83387bbac4fb6ff46f4cf1153e37837b626

Use WebSockets for events

view details

leo60228

commit sha 7e67e10bc473311602e5d9704c7ceaa96bdb2581

Remove url 2.x I thought tungstenite needed it, but it doesn't.

view details

leo60228

commit sha a59ad95188771b58bcba08b2c3252cdc890701b6

Fix README doctest

view details

push time in a month

PR merged pwoolcoc/elefren

Use WebSockets for events

Closes #125

A lot of this code is to avoid a breaking change. It could probably be reduced pretty heavily if that's not a concern.

+173 -58

1 comment

4 changed files

leo60228

pr closed time in a month

issue closedpwoolcoc/elefren

Use Websockets For Streaming

Pleroma does not support SSE for streaming events, which means clients that use the streaming API via elefren don't work fully with Pleroma.

closed time in a month

BrainBlasted

pull request commentpwoolcoc/elefren

Use WebSockets for events

Thanks, and sorry it's sat here for so long!

leo60228

comment created time in a month

push eventpwoolcoc/rustrogueliketutorial

Paul Woolcock

commit sha 9f2b4faebb18f29a1a2212d08bff7db8e962c772

Fix link to Rogue in chapter 3

view details

push time in 2 months

fork pwoolcoc/rustrogueliketutorial

Roguelike Tutorial in Rust - using RLTK

fork in 2 months

PR opened http-rs/surf

Add an `add_header` method to `Request`

This corresponds to http-types append_header method, and will assist in correctly converting http_types::Request objects to surf::Request objects.

+23 -0

0 comment

1 changed file

pr created time in 2 months

create barnchpwoolcoc/surf

branch : add-header-method

created branch time in 2 months

delete branch pwoolcoc/wiremock-rs

delete branch : add-display-impl-and-log-unknown-request

delete time in 2 months

push eventpwoolcoc/wiremock-rs

Paul Woolcock

commit sha 410ec223511acac017e6d297a96349cccfbc0e22

Add a Display impl for Request and log unknown requests

view details

push time in 2 months

create barnchpwoolcoc/wiremock-rs

branch : add-display-impl-and-log-unknown-request

created branch time in 2 months

fork pwoolcoc/wiremock-rs

HTTP mocking to test Rust applications.

fork in 2 months

push eventpwoolcoc/soup

Alexander Batischev

commit sha 299868eba70427593d2fb022a972c9eaf0c79173

README: Bump version in example Cargo.toml

view details

Alexander Batischev

commit sha 25f896d8b0c621e90caf295692cec050d419ff41

Rustdoc: make first example show the import When I opened this crate's docs, I started reading it from the top, found the first example, copied it to a file -- and failed to compile it because the import was missing. Jumping to the list of modules, it was obvious to me what to import, but I wish that hurdle wasn't there in the first place.

view details

Paul Woolcock

commit sha 9b1380cce9f643f6df6b0d745bd0cdae1a7e89d0

Merge branch 'feature/docs-improvements' into 'master' Improve documentation See merge request pwoolcoc/soup!7

view details

push time in 2 months

push eventpwoolcoc/elefren

Julian Hofer

commit sha 9b538fdc65e70d6b9e574366267c4743f66cbf05

Fix link to Mastodon's documentation

view details

Julian

commit sha b877d7983116661a60de815aa0a22762847cbe78

Use more suitable link to Mastodon's documentation

view details

push time in 2 months

PR merged pwoolcoc/elefren

Fix link to Mastodon's documentation
+1 -2

4 comments

1 changed file

Hofer-Julian

pr closed time in 2 months

pull request commentpwoolcoc/elefren

Fix link to Mastodon's documentation

the failed builds don't look to be related to this, so I'm just gonna merge it. Thanks for the PR!

Hofer-Julian

comment created time in 2 months

issue openedhttp-rs/surf

Content-type doesn't get correctly copied over when converting from `http_types::Request`

If you convert from http_types::Request to surf::Request using surf::Request::try_from(http_types::Request), the content-type doesn't get coped over correctly. Below is my Cargo.toml and src/lib.rs, with a test that duplicates the error.

# Cargo.toml
[package]
...

[dependencies]
surf = "2.0.0-alpha.2"
http-types = "1.2.0"
url = "2.1.1"

# src/lib.rs
use http_types::headers::{HeaderName, HeaderValue};
use url::Url;
use std::convert::TryFrom;

#[test]
fn content_type_change() {
    let mut http_types_request = http_types::Request::new(http_types::Method::Get, Url::parse("https://example.com/").unwrap());
    http_types_request.insert_header("Content-Type", http_types::mime::JSON);

    let surf_request = surf::Request::try_from(http_types_request).unwrap();
    let content_type = HeaderName::try_from("Content-Type").unwrap();

    let expected = HeaderValue::try_from("application/json").unwrap();
    assert_eq!(
        &expected,
        surf_request.header(&content_type).unwrap().get(0).unwrap(),
    );
}

// running 1 test
// test content_type_change ... FAILED
// 
// failures:
// 
// ---- content_type_change stdout ----
// thread 'content_type_change' panicked at 'assertion failed: `(left == right)`
//   left: `HeaderValue { inner: "application/json" }`,
//  right: `HeaderValue { inner: "application/octet-stream" }`', src/lib.rs:14:5
// note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
// 
// 
// failures:
//     content_type_change
// 
// test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
// 
// error: test failed, to rerun pass '--lib'

created time in 2 months

pull request commentkillercup/cargo-edit

Move from `error-chain` to `thiserror`

sorry for the radio silence, I'm still working on this and will try to update here as soon as I can

pwoolcoc

comment created time in 2 months

pull request commentrust-itertools/itertools

Add `chunk_while` iterator

@phimuemue thanks, I'm looking into that right now and I'll update here when I can

pwoolcoc

comment created time in 2 months

push eventpwoolcoc/mastodon-api-models

Paul Woolcock

commit sha eb077e836190906bf9b0c09a0fb99922e6bd4ece

Initial commit

view details

push time in 3 months

push eventpwoolcoc/mastodon-api-models

Paul Woolcock

commit sha da2c8b19b7c3f40d48cc824d3a7fc1fd953af883

Initial commit

view details

push time in 3 months

create barnchpwoolcoc/mastodon-api-models

branch : master

created branch time in 3 months

created repositorypwoolcoc/mastodon-api-models

created time in 3 months

issue openedHoverbear/getset

Raw identifiers are not supported

It appears that the Getters derive panics when encountering a raw identifier. The error was reproducible on master as well as the most recently published crates.io version:

± cargo build
   Compiling getset-bug v0.1.0 (/Users/pwoolcock/code/getset-bug)
thread 'rustc' panicked at '`"r#type"` is not a valid identifier', src/librustc_expand/proc_macro_server.rs:329:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0-nightly (f4c675c47 2020-03-19) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: proc-macro derive panicked
 --> src/lib.rs:3:10
  |
3 | #[derive(Getters)]
  |          ^^^^^^^
  |
  = help: message: `"r#type"` is not a valid identifier

error: aborting due to previous error

error: could not compile `getset-bug`.

To learn more, run the command again with --verbose.

and here's the code I used to generate this error:

use getset::Getters;

#[derive(Getters)]
pub struct Foo {
    r#type: String,
}

created time in 3 months

push eventpwoolcoc/itertools

Paul Woolcock

commit sha 7c75b7f9cbbfda6e4b833e28b1877c698bf1012b

Add `chunk_while` iterator This is an iterator that is a mix of `std::slice::chunks` and `fold`. Instead of chunking the source up into predictable lengths though, it allows the user to inspect each element of the source, along with a state, and decide when the chunk is big enough.

view details

push time in 3 months

pull request commentrust-itertools/itertools

Add `chunk_while` iterator

two things I'm unhappy with:

  1. type Item = Vec<T>. I wish that could be type Item = &'a [T], but then I run into the problem of tying 'a to self in fn next(&mut self, ...). If anyone has a way I can do this, I'm all ears.
  2. B: Clone. I'm not sure if there's a way to do this or not, but every time it starts accumulating a new chunk, it needs to reset the state. Again, if there's a better way, I'd love to hear about it
pwoolcoc

comment created time in 3 months

pull request commentrust-itertools/itertools

Add `chunk_while` iterator

Sorry if I should have taken this to the stdlib first, but given

if your feature involves heap allocation, such as storing elements in a Vec<T>, then it can't be accepted into libcore, and you should propose it for itertools directly instead.

I figured I would just bring it here, since it uses a Vec internally

pwoolcoc

comment created time in 3 months

PR opened rust-itertools/itertools

Add `chunk_while` iterator

This is an iterator that is a mix of std::slice::chunks and fold. Instead of chunking the source up into predictable lengths though, it allows the user to inspect each element of the source, along with a state, and decide when the chunk is big enough.

+116 -1

0 comment

2 changed files

pr created time in 3 months

create barnchpwoolcoc/itertools

branch : add-chunk-while-iterator

created branch time in 3 months

fork pwoolcoc/itertools

Extra iterator adaptors, iterator methods, free functions, and macros.

https://docs.rs/itertools/

fork in 3 months

Pull request review commentkillercup/cargo-edit

Move from `error-chain` to `thiserror`

-error_chain! {-    foreign_links {-        Io(::std::io::Error) #[doc = "An error from the std::io module"];-        Git(::git2::Error)#[doc = "An error from the git2 crate"];-        CargoMetadata(::failure::Compat<::cargo_metadata::Error>)#[doc = "An error from the cargo_metadata crate"];-    }+use thiserror::Error as ThisError; -    errors {-        /// Failed to read home directory-        ReadHomeDirFailure {-            description("Failed to read home directory")-        }-        /// Invalid JSON in registry index-        InvalidSummaryJson {-            description("Invalid JSON in registry index")-        }-        /// Given crate name is empty-        EmptyCrateName{-            description("Found empty crate name")-        }-        /// No crate by that name exists-        NoCrate(name: String) {-            description("The crate could not be found in registry index.")-            display("The crate `{}` could not be found in registry index.", name)-        }-        /// No versions available-        NoVersionsAvailable {-            description("No available versions exist. Either all were yanked \-                         or only prerelease versions exist. Trying with the \-                         --allow-prerelease flag might solve the issue."-            )-        }-        /// Unable to parse external Cargo.toml-        ParseCargoToml {-            description("Unable to parse external Cargo.toml")-        }-        /// Cargo.toml could not be found.-        MissingManifest {-            description("Unable to find Cargo.toml")-        }-        /// Cargo.toml is valid toml, but doesn't contain the expected fields-        InvalidManifest {-            description("Cargo.toml missing expected `package` or `project` fields")-        }-        /// Found a workspace manifest when expecting a normal manifest-        UnexpectedRootManifest {-            description("Found virtual manifest, but this command requires running against an \-                         actual package in this workspace.")-        }-        /// The TOML table could not be found.-        NonExistentTable(table: String) {-            description("non existent table")-            display("The table `{}` could not be found.", table)-        }-        /// The dependency could not be found.-        NonExistentDependency(name: String, table: String) {-            description("non existent dependency")-            display("The dependency `{}` could not be found in `{}`.", name, table)-        }-        /// Config of cargo is invalid-        InvalidCargoConfig {-            description("Invalid cargo config")-        }-        /// Unable to find the source specified by 'replace-with'-        NoSuchSourceFound(name: String) {-            description("Unable to find the source specified by 'replace-with'")-            display("The source '{}' could not be found", name)-        }-        /// Unable to find the specified registry-        NoSuchRegistryFound(name: String) {-            display("The registry '{}' could not be found", name)-        }-        /// Failed to parse a version for a dependency-        ParseVersion(version: String, dep: String) {-            description("Failed to parse a version for a dependency")-            display("The version `{}` for the dependency `{}` couldn't be parsed", version, dep)-        }-    }+/// Main error type+#[derive(Debug, ThisError)]+pub enum Error {+    // foreign links+    /// An error from the std::io module+    #[error(transparent)]+    Io(#[from] std::io::Error),+    ///  An error from the git2 crate+    #[error(transparent)]+    Git(#[from] git2::Error),+    /// An error from the cargo_metadata crate+    #[error(transparent)]+    CargoMetadata(#[from] cargo_metadata::Error),+    /// An error from the toml_edit crate+    #[error(transparent)]+    TomlEditParse(#[from] toml_edit::TomlError),+    /// A ReqParseError from the semver crate+    #[error(transparent)]+    SemVerParse(#[from] semver::ReqParseError),+    /// A SemVerError from the semver crate+    #[error(transparent)]+    SemVer(#[from] semver::SemVerError),+    /// An error from the reqwest crate+    #[error(transparent)]+    Reqwest(#[from] reqwest::Error),+    /// An error from the serde_json crate+    #[error(transparent)]+    Json(#[from] serde_json::Error),+    /// An error from converting bytes to a utf8 string+    #[error(transparent)]+    FromUtf8(#[from] std::string::FromUtf8Error),++    /// A value was expected but we got `None` instead+    #[error("Expected a value")]+    ExpectedValue,++    /// Given crate name is empty+    #[error("Found empty crate name")]+    EmptyCrateName,++    /// No versions available+    #[error("No available versions exist. Either all were yanked or only prerelease versions exist. Trying with the --allow-prerelease flag might solve the issue.")]+    NoVersionsAvailable,++    /// A resource was invalid+    #[error("Invalid: {0}")]+    Invalid(String),++    /// Found a workspace manifest when expecting a normal manifest+    #[error("Found virtual manifest, but this command requires running against an actual package in this workspace.")]+    UnexpectedRootManifest,++    /// Unable to find the specified resource+    #[error("The resource `{0}` could not be found.")]+    NotFound(String),++    /// Unable to find the specified resource+    #[error("The resource `{0}` could not be found in `{1}`.")]+    NotFoundIn(String, String),

I split them up because the second error message is helpful in giving a location for the error, i.e. it ends up looking like "the resource serde could not be found in dev-dependencies", and I liked having that location information.

pwoolcoc

comment created time in 3 months

Pull request review commentkillercup/cargo-edit

Move from `error-chain` to `thiserror`

-error_chain! {-    foreign_links {-        Io(::std::io::Error) #[doc = "An error from the std::io module"];-        Git(::git2::Error)#[doc = "An error from the git2 crate"];-        CargoMetadata(::failure::Compat<::cargo_metadata::Error>)#[doc = "An error from the cargo_metadata crate"];-    }+use thiserror::Error as ThisError; -    errors {-        /// Failed to read home directory-        ReadHomeDirFailure {-            description("Failed to read home directory")-        }-        /// Invalid JSON in registry index-        InvalidSummaryJson {-            description("Invalid JSON in registry index")-        }-        /// Given crate name is empty-        EmptyCrateName{-            description("Found empty crate name")-        }-        /// No crate by that name exists-        NoCrate(name: String) {-            description("The crate could not be found in registry index.")-            display("The crate `{}` could not be found in registry index.", name)-        }-        /// No versions available-        NoVersionsAvailable {-            description("No available versions exist. Either all were yanked \-                         or only prerelease versions exist. Trying with the \-                         --allow-prerelease flag might solve the issue."-            )-        }-        /// Unable to parse external Cargo.toml-        ParseCargoToml {-            description("Unable to parse external Cargo.toml")-        }-        /// Cargo.toml could not be found.-        MissingManifest {-            description("Unable to find Cargo.toml")-        }-        /// Cargo.toml is valid toml, but doesn't contain the expected fields-        InvalidManifest {-            description("Cargo.toml missing expected `package` or `project` fields")-        }-        /// Found a workspace manifest when expecting a normal manifest-        UnexpectedRootManifest {-            description("Found virtual manifest, but this command requires running against an \-                         actual package in this workspace.")-        }-        /// The TOML table could not be found.-        NonExistentTable(table: String) {-            description("non existent table")-            display("The table `{}` could not be found.", table)-        }-        /// The dependency could not be found.-        NonExistentDependency(name: String, table: String) {-            description("non existent dependency")-            display("The dependency `{}` could not be found in `{}`.", name, table)-        }-        /// Config of cargo is invalid-        InvalidCargoConfig {-            description("Invalid cargo config")-        }-        /// Unable to find the source specified by 'replace-with'-        NoSuchSourceFound(name: String) {-            description("Unable to find the source specified by 'replace-with'")-            display("The source '{}' could not be found", name)-        }-        /// Unable to find the specified registry-        NoSuchRegistryFound(name: String) {-            display("The registry '{}' could not be found", name)-        }-        /// Failed to parse a version for a dependency-        ParseVersion(version: String, dep: String) {-            description("Failed to parse a version for a dependency")-            display("The version `{}` for the dependency `{}` couldn't be parsed", version, dep)-        }-    }+/// Main error type+#[derive(Debug, ThisError)]+pub enum Error {+    // foreign links+    /// An error from the std::io module+    #[error(transparent)]+    Io(#[from] std::io::Error),+    ///  An error from the git2 crate+    #[error(transparent)]+    Git(#[from] git2::Error),+    /// An error from the cargo_metadata crate+    #[error(transparent)]+    CargoMetadata(#[from] cargo_metadata::Error),+    /// An error from the toml_edit crate+    #[error(transparent)]+    TomlEditParse(#[from] toml_edit::TomlError),+    /// A ReqParseError from the semver crate+    #[error(transparent)]+    SemVerParse(#[from] semver::ReqParseError),+    /// A SemVerError from the semver crate+    #[error(transparent)]+    SemVer(#[from] semver::SemVerError),

Unfortunately source errors are completely separate types so we'd either lose those or have to cast them to trait objects or something

pwoolcoc

comment created time in 3 months

Pull request review commentkillercup/cargo-edit

Move from `error-chain` to `thiserror`

-error_chain! {-    foreign_links {-        Io(::std::io::Error) #[doc = "An error from the std::io module"];-        Git(::git2::Error)#[doc = "An error from the git2 crate"];-        CargoMetadata(::failure::Compat<::cargo_metadata::Error>)#[doc = "An error from the cargo_metadata crate"];-    }--    errors {-        /// Failed to read home directory-        ReadHomeDirFailure {-            description("Failed to read home directory")-        }-        /// Invalid JSON in registry index-        InvalidSummaryJson {-            description("Invalid JSON in registry index")-        }-        /// Given crate name is empty-        EmptyCrateName{-            description("Found empty crate name")-        }-        /// No crate by that name exists-        NoCrate(name: String) {-            description("The crate could not be found in registry index.")-            display("The crate `{}` could not be found in registry index.", name)-        }-        /// No versions available-        NoVersionsAvailable {-            description("No available versions exist. Either all were yanked \-                         or only prerelease versions exist. Trying with the \-                         --allow-prerelease flag might solve the issue."-            )-        }-        /// Unable to parse external Cargo.toml-        ParseCargoToml {-            description("Unable to parse external Cargo.toml")-        }-        /// Cargo.toml could not be found.-        MissingManifest {-            description("Unable to find Cargo.toml")-        }-        /// Cargo.toml is valid toml, but doesn't contain the expected fields-        InvalidManifest {-            description("Cargo.toml missing expected `package` or `project` fields")-        }-        /// Found a workspace manifest when expecting a normal manifest-        UnexpectedRootManifest {-            description("Found virtual manifest, but this command requires running against an \-                         actual package in this workspace.")-        }-        /// The TOML table could not be found.-        NonExistentTable(table: String) {-            description("non existent table")-            display("The table `{}` could not be found.", table)-        }-        /// The dependency could not be found.-        NonExistentDependency(name: String, table: String) {-            description("non existent dependency")-            display("The dependency `{}` could not be found in `{}`.", name, table)-        }-        /// Config of cargo is invalid-        InvalidCargoConfig {-            description("Invalid cargo config")-        }-        /// Unable to find the source specified by 'replace-with'-        NoSuchSourceFound(name: String) {-            description("Unable to find the source specified by 'replace-with'")-            display("The source '{}' could not be found", name)-        }-        /// Unable to find the specified registry-        NoSuchRegistryFound(name: String) {-            display("The registry '{}' could not be found", name)-        }-        /// Failed to parse a version for a dependency-        ParseVersion(version: String, dep: String) {-            description("Failed to parse a version for a dependency")-            display("The version `{}` for the dependency `{}` couldn't be parsed", version, dep)-        }-    }+use thiserror::Error as ThisError;++/// Main error type+#[derive(Debug, ThisError)]+pub enum Error {+    // foreign links+    /// An error from the std::io module+    #[error(transparent)]+    Io(#[from] std::io::Error),+    ///  An error from the git2 crate+    #[error(transparent)]+    Git(#[from] git2::Error),+    /// An error from the cargo_metadata crate+    #[error(transparent)]+    CargoMetadata(#[from] cargo_metadata::Error),+    /// An error from the toml_edit crate+    #[error(transparent)]+    TomlEditParse(#[from] toml_edit::TomlError),+    /// A ReqParseError from the semver crate+    #[error(transparent)]+    SemVerParse(#[from] semver::ReqParseError),+    /// A SemVerError from the semver crate+    #[error(transparent)]+    SemVer(#[from] semver::SemVerError),+    /// An error from the reqwest crate+    #[error(transparent)]+    Reqwest(#[from] reqwest::Error),++    /// Failed to read home directory+    #[error("Failed to read home directory")]+    ReadHomeDirFailure,++    /// Invalid JSON in registry index+    #[error("Invalid JSON in registry index")]+    InvalidSummaryJson,++    /// Given crate name is empty+    #[error("Found empty crate name")]+    EmptyCrateName,++    /// No crate by that name exists+    #[error("The crate `{0}` could not be found in registry index.")]+    NoCrate(String),++    /// No versions available+    #[error("No available versions exist. Either all were yanked or only prerelease versions exist. Trying with the --allow-prerelease flag might solve the issue.")]+    NoVersionsAvailable,++    /// Unable to parse external Cargo.toml+    #[error("Unable to parse external Cargo.toml")]+    ParseCargoToml,++    /// Cargo.toml could not be found.+    #[error("Unable to find Cargo.toml")]+    MissingManifest,++    /// Cargo.toml is valid toml, but doesn't contain the expected fields+    #[error("Cargo.toml missing expected `package` or `project` fields")]+    InvalidManifest,++    /// Found a workspace manifest when expecting a normal manifest+    #[error("Found virtual manifest, but this command requires running against an actual package in this workspace.")]+    UnexpectedRootManifest,++    /// The TOML table could not be found.+    #[error("The table `{0}` could not be found.")]+    NonExistentTable(String),++    /// The dependency could not be found.+    #[error("The dependency `{name}` could not be found in `{table}`.")]+    NonExistentDependency {+        /// Name of the non-existent dependency+        name: String,+        /// Table of dependencies+        table: String,+    },++    /// Config of cargo is invalid+    #[error("Invalid cargo config")]+    InvalidCargoConfig,++    /// Unable to find the source specified by 'replace-with'+    #[error("The source '{0}' could not be found")]+    NoSuchSourceFound(String),++    /// Unable to find the specified registry+    #[error("The registry '{0}' could not be found")]+    NoSuchRegistryFound(String),++    /// Failed to parse a version for a dependency+    #[error("The version `{0}` for the dependency `{1}` couldn't be parsed")]+    ParseReqVersion(String, String, #[source] semver::ReqParseError),++    /// Failed to parse a version for a dependency+    #[error("The version `{0}` for the dependency `{1}` couldn't be parsed")]+    ParseVersion(String, String, #[source] semver::SemVerError),++    /// An invalid crate version requirement was encountered+    #[error("Invalid crate version requirement")]+    InvalidCrateVersionReq(#[source] semver::ReqParseError),++    /// Unable to get crate name from a URI+    #[error("Unable to obtain crate informations from `{0}`.\n")]+    ParseCrateNameFromUri(String),++    /// Unable to get a crate from a git repository+    #[error("Failed to fetch crate from git")]+    FetchCrateFromGit(#[source] reqwest::Error),++    /// Received an invalid response from a git repository+    #[error("Git response not a valid `String`")]+    InvalidGitResponse(#[source] std::io::Error),++    /// Could not read manifest contents+    #[error("Failed to read manifest contents")]+    ManifestReadError(#[source] std::io::Error),++    /// Could not parse Cargo.toml+    #[error("Unable to parse Cargo.toml")]+    ManifestParseError(#[source] Box<Error>),++    /// Cargo.toml contained invalid TOML+    #[error("Manifest not valid TOML")]+    ManifestInvalidToml(#[source] toml_edit::TomlError),++    /// Could not found Cargo.toml+    #[error("Failed to find Cargo.toml")]+    ManifestNotLocated(#[source] std::io::Error),++    /// Could not get cargo metadata+    #[error("Failed to get cargo file metadata")]+    GetCargoMetadata(#[source] std::io::Error),++    /// Could not get current directory+    #[error("Failed to get current directory")]+    GetCwd(#[source] std::io::Error),++    /// Could not set output colour+    #[error("Failed to set output colour")]+    SetOutputColour(#[source] std::io::Error),++    /// Could not write upgrade message+    #[error("Failed to write upgrade message")]+    WriteUpgradeMessage(#[source] std::io::Error),++    /// Could not clear output colour+    #[error("Failed to clear output colour")]+    ClearOutputColour(#[source] std::io::Error),++    /// Could not write upgraded versions+    #[error("Failed to write upgrade versions")]+    WriteUpgradeVersions(#[source] std::io::Error),++    /// Could not print upgrade message+    #[error("Failed to print upgrade message")]+    PrintUpgradeMessage(#[source] std::io::Error),++    /// Could not truncate Cargo.toml+    #[error("Failed to truncate Cargo.toml")]+    TruncateCargoToml(#[source] std::io::Error),++    /// Could not write updated Cargo.toml+    #[error("Failed to write updated Cargo.toml")]+    WriteUpdatedCargoToml(#[source] std::io::Error),++    /// Missing Version Field+    #[error("Missing version field")]+    MissingVersionField,++    /// Could not write new manifest contents+    #[error("Failed to write new manifest contents")]+    WriteNewManifestContents(#[source] Box<Error>),++    /// Could not open Cargo.toml+    #[error("Unable to open local Cargo.toml")]+    OpenLocalManifest(#[source] Box<Error>),++    /// Git repo URL seems incomplete+    #[error("Git repo url seems incomplete")]+    IncompleteGitUrl,++    /// Could not parse git repo URL+    #[error("Unable to parse git repo URL")]+    ParseGitUrl,++    /// Found a virtual manifest instead of an actual manifest+    #[error("Found virtual manifest, but this command requires running against an  actual package in this workspace. Try adding `--workspace`.")]+    VirtualManifest,

🤣 yea, agreed that it's a lot. I've cut it way down in my latest commit, let me know what you think

pwoolcoc

comment created time in 3 months

created tagpwoolcoc/elefren

tagv0.21.0

It's like Mastodon.py, but for Rust

created time in 3 months

push eventpwoolcoc/elefren

Paul Woolcock

commit sha 2a5200ab890a90e803be16b28e4c7ef86b3f678d

v0.21.0

view details

push time in 3 months

push eventpwoolcoc/cargo-edit

Paul Woolcock

commit sha 2760f26ad9628b5b7b2c284a8c1de52e5a48c80b

Reduce the number of possible errors

view details

push time in 3 months

pull request commentkillercup/cargo-edit

Move from `error-chain` to `thiserror`

r? @ordian (and @yaahc if you are available!)

pwoolcoc

comment created time in 3 months

Pull request review commentkillercup/cargo-edit

Move from `error-chain` to `thiserror`

 fn main() {     if let Err(err) = handle_add(&args) {         eprintln!("Command failed due to unhandled error: {}\n", err); -        for e in err.iter().skip(1) {-            eprintln!("Caused by: {}", e);-        }--        if let Some(backtrace) = err.backtrace() {-            eprintln!("Backtrace: {:?}", backtrace);

anyhow can display backtraces as long as it was complied by nightly, since the stdlib backtrace feature is still unstable. I've tried to convince failure::Fail::backtrace to accept an anyhow::Error and try to get a backtrace out of it, but haven't had any luck. anyhow::Error will deref to a dyn Error + Send + Sync + 'static, but Fail::backtrace complains that it is unsized.

I've added a feature that will allow a user to compile with backtrace support as long as they are on nightly, but if there is a better way I'd be more than happy to use it.

pwoolcoc

comment created time in 3 months

push eventpwoolcoc/cargo-edit

Paul Woolcock

commit sha b503e364aa1b28588f8c79a3680db9e0cd4b389e

Remove `anyhow` from the library As @yaahc pointed out, if we immediately erase the error type by converting it to `anyhow::Error` then there's not much reason to have a library error type. This commit puts _all_ errors generated in the library into the Error enum and removes use of `anyhow` from the library completely. Note that `anyhow` is still used in the 3 binaries.

view details

push time in 3 months

push eventpwoolcoc/cargo-edit

Paul Woolcock

commit sha 57662167599437b6a4ffc1a9832dbb10d28462a8

Remove `anyhow` from the library As @yaahc pointed out, if we immediately erase the error type by converting it to `anyhow::Error` then there's not much reason to have a library error type. This commit puts _all_ errors generated in the library into the Error enum and removes use of `anyhow` from the library completely. Note that `anyhow` is still used in the 3 binaries.

view details

push time in 3 months

pull request commentkillercup/cargo-edit

Move from `error-chain` to `thiserror`

thanks @ordian @killercup @yaahc , I think I know where to go with it.

pwoolcoc

comment created time in 3 months

push eventpwoolcoc/elefren

Paul Woolcock

commit sha 6b92b5f6483acffdcf1c5ba3a75cf14476f71db7

Update README for 2018 edition

view details

push time in 3 months

push eventpwoolcoc/elefren

Paul Woolcock

commit sha 36734709186ae2bdd1441b1ec110f82a85deca98

Update readme for version 0.20

view details

push time in 3 months

push eventpwoolcoc/elefren

Paul Woolcock

commit sha 336e87076ae99669a92600204c249e0d607bcaa7

Switch build badge back to travis-ci

view details

push time in 3 months

pull request commentpwoolcoc/elefren

Update pretty_env_logger requirement from 0.3.0 to 0.4.0

@dependabot-bot rebase

dependabot-preview[bot]

comment created time in 3 months

delete branch pwoolcoc/elefren

delete branch : dependabot/cargo/reqwest-0.10

delete time in 3 months

PR closed pwoolcoc/elefren

Update reqwest requirement from 0.9 to 0.10 dependencies

Updates the requirements on reqwest to permit the latest version. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/seanmonstar/reqwest/releases">reqwest's releases</a>.</em></p> <blockquote> <h1>v0.10.0</h1> <ul> <li> <p>Add <code>std::future::Future</code> support.</p> </li> <li> <p>Add <code>wasm32-unknown-unknown</code> support (with fewer features).</p> </li> <li> <p>Add ability to pass async <code>Response</code> as the <code>body</code> of another <code>Request</code>.</p> </li> <li> <p>Add <code>Body::as_bytes()</code> method.</p> </li> <li> <p>Add <code>Response::bytes_stream()</code> method to get body as an <code>impl Stream</code>.</p> </li> <li> <p>Add <code>Request::try_clone()</code> method.</p> </li> <li> <p>Change default <code>Client</code> API to async. The previous blocking client API is avaialble at <code>reqwest::blocking</code>.</p> </li> <li> <p>Change to no longer send a default <code>User-Agent</code> header. Add one via <code>ClientBuilder::user_agent()</code>.</p> </li> <li> <p>Change to enable system/environment proxy detection by default.</p> </li> <li> <p>Change <code>default-tls</code> feature to only include <code>ClientBuilder</code> options that both <code>native-tls</code> and <code>rustls</code> support.</p> </li> <li> <p>Change default feature set to reduce unnecessary dependencies. Most features are disabled by default:</p> <ul> <li><code>blocking</code>: The <code>reqwest::blocking</code> (synchronous) client API.</li> <li><code>cookies</code>: Cookie store support.</li> <li><code>gzip</code>: Automatic response body decompression.</li> <li><code>json</code>: Request and response JSON body methods.</li> <li><code>stream</code>: <code>futures::Stream</code> support.</li> </ul> </li> <li> <p>Change <code>Error</code> internal design, removing several <code>Error::is_</code> inspector methods.</p> </li> <li> <p>Change Redirect API:</p> <ul> <li>Renamed types to be part of the <code>redirect</code> module (for example, <code>reqwest::RedirectPolicy</code> is now <code>reqwest::redirect::Policy</code>).</li> <li>Removed <code>loop_detected</code> and <code>too_many_redirect</code> methods from <code>redirect::Attempt</code>, replaced with a generic <code>error</code> method.</li> <li>The default policy no longer specifically looks for redirect loops (but they should be caught by the maximum limit).</li> </ul> </li> <li> <p>Fix checking <code>HTTP_PROXY</code> environment variable if it the environment is from a CGI script.</p> </li> <li> <p>Fix removal of username/password of parsed proxy URL.</p> </li> <li> <p>Update <code>url</code> to v2.0.</p> </li> <li> <p>Update <code>hyper</code> to v0.13.</p> </li> <li> <p>Update <code>http</code> to v0.2.</p> </li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md">reqwest's changelog</a>.</em></p> <blockquote> <h1>v0.10.0</h1> <ul> <li> <p>Add <code>std::future::Future</code> support.</p> </li> <li> <p>Add <code>wasm32-unknown-unknown</code> support (with fewer features).</p> </li> <li> <p>Add ability to pass async <code>Response</code> as the <code>body</code> of another <code>Request</code>.</p> </li> <li> <p>Add <code>Body::as_bytes()</code> method.</p> </li> <li> <p>Add <code>Response::bytes_stream()</code> method to get body as an <code>impl Stream</code>.</p> </li> <li> <p>Add <code>Request::try_clone()</code> method.</p> </li> <li> <p>Change default <code>Client</code> API to async. The previous blocking client API is avaialble at <code>reqwest::blocking</code>.</p> </li> <li> <p>Change to no longer send a default <code>User-Agent</code> header. Add one via <code>ClientBuilder::user_agent()</code>.</p> </li> <li> <p>Change to enable system/environment proxy detection by default.</p> </li> <li> <p>Change <code>default-tls</code> feature to only include <code>ClientBuilder</code> options that both <code>native-tls</code> and <code>rustls</code> support.</p> </li> <li> <p>Change default feature set to reduce unnecessary dependencies. Most features are disabled by default:</p> <ul> <li><code>blocking</code>: The <code>reqwest::blocking</code> (synchronous) client API.</li> <li><code>cookies</code>: Cookie store support.</li> <li><code>gzip</code>: Automatic response body decompression.</li> <li><code>json</code>: Request and response JSON body methods.</li> <li><code>stream</code>: <code>futures::Stream</code> support.</li> </ul> </li> <li> <p>Change <code>Error</code> internal design, removing several <code>Error::is_</code> inspector methods.</p> </li> <li> <p>Change Redirect API:</p> <ul> <li>Renamed types to be part of the <code>redirect</code> module (for example, <code>reqwest::RedirectPolicy</code> is now <code>reqwest::redirect::Policy</code>).</li> <li>Removed <code>loop_detected</code> and <code>too_many_redirect</code> methods from <code>redirect::Attempt</code>, replaced with a generic <code>error</code> method.</li> <li>The default policy no longer specifically looks for redirect loops (but they should be caught by the maximum limit).</li> </ul> </li> <li> <p>Fix checking <code>HTTP_PROXY</code> environment variable if it the environment is from a CGI script.</p> </li> <li> <p>Fix removal of username/password of parsed proxy URL.</p> </li> <li> <p>Update <code>url</code> to v2.0.</p> </li> <li> <p>Update <code>hyper</code> to v0.13.</p> </li> <li> <p>Update <code>http</code> to v0.2.</p> </li> </ul> <h2>v0.9.19</h2> <ul> <li>Add <code>ClientBuilder::use_sys_proxy()</code> to enable automatic detect of HTTP proxies configured on the system.</li> <li>Add <code>ClientBuilder::no_proxy()</code> to disable system proxies. This is the default for 0.9, but will change to detecting system proxies by default in 0.10.</li> <li>Add support for streaming request bodies in the async client.</li> <li>Add <code>async::Response::text()</code> that returns a <code>Future</code> of the full body decoded to a <code>String</code>.</li> <li>Add <code>Clone</code> for <code>Certificate</code>.</li> </ul> <h2>v0.9.18</h2> <ul> <li>Fix <code>Cookie</code> headers to no longer send as percent-encoded (instead, exactly as sent by the server).</li> </ul> <h2>v0.9.17</h2> <ul> <li>Fix <code>Cookie</code> headers so as to not include attributes from the <code>Set-Cookie</code> (like <code>HttpOnly</code>, <code>Secure</code>, etc).</li> </ul> <h2>v0.9.16</h2> </tr></table> ... (truncated) </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/seanmonstar/reqwest/commit/35c6ddd00b20243106e11ca9aa46abbc33d56bc9"><code>35c6ddd</code></a> v0.10.0</li> <li><a href="https://github.com/seanmonstar/reqwest/commit/c88d3b7aa644ef2534be2d8a2160fe33c44814f4"><code>c88d3b7</code></a> Remove disabled examples</li> <li><a href="https://github.com/seanmonstar/reqwest/commit/09e7fe62e3c4e6e8f814a8d9dbf7f981be515c36"><code>09e7fe6</code></a> Don't set User-Agent header by default (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/751">#751</a>)</li> <li><a href="https://github.com/seanmonstar/reqwest/commit/47734f55f4cf60b928973e61afb957f9e6bcaf61"><code>47734f5</code></a> Replace futures-channel with tokio::sync in blocking client (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/748">#748</a>)</li> <li><a href="https://github.com/seanmonstar/reqwest/commit/0ab5df39ccab1bd83a34a65fa4dc37da14c8d939"><code>0ab5df3</code></a> Add <code>Response::bytes_stream()</code> (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/750">#750</a>)</li> <li><a href="https://github.com/seanmonstar/reqwest/commit/24abf2fcbdabbc63136677bc440788271484d103"><code>24abf2f</code></a> Separate default-tls and native-tls features (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/749">#749</a>)</li> <li><a href="https://github.com/seanmonstar/reqwest/commit/18fd9a63b0eb7bf51d2e2b7fe31b4567f0b05779"><code>18fd9a6</code></a> Re-enable rustls (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/747">#747</a>)</li> <li><a href="https://github.com/seanmonstar/reqwest/commit/f78846b6f15e82e60c8a83e7b3a7137e19f94884"><code>f78846b</code></a> Add note about how to use tokio::main in examples (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/745">#745</a>)</li> <li><a href="https://github.com/seanmonstar/reqwest/commit/c4c754c0fdcb44cae73950a2bca8aa0acee800ee"><code>c4c754c</code></a> Remove a few unused public pieces from the cookie module (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/744">#744</a>)</li> <li><a href="https://github.com/seanmonstar/reqwest/commit/ce43f80d8be3fef72267483aeba0a6927f150035"><code>ce43f80</code></a> Refactor Redirect API (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/741">#741</a>)</li> <li>Additional commits viewable in <a href="https://github.com/seanmonstar/reqwest/compare/v0.9.0...v0.10.0">compare view</a></li> </ul> </details> <br />

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


<details> <summary>Dependabot commands and options</summary> <br />

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
  • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot dashboard:

  • Update frequency (including time of day and day of week)
  • Pull request limits (per update run and/or open at any time)
  • Automerge options (never/patch/minor, and dev/runtime dependencies)
  • Out-of-range updates (receive only lockfile updates, if desired)
  • Security updates (receive only security updates, if desired)

</details>

+1 -1

0 comment

1 changed file

dependabot-preview[bot]

pr closed time in 3 months

pull request commentpwoolcoc/elefren

Update serde_qs requirement from 0.4.5 to 0.5.2

@dependabot-bot rebase

dependabot-preview[bot]

comment created time in 3 months

issue commentpwoolcoc/elefren

Remove mention of fork.

yep, sorry, corrected

XAMPPRocky

comment created time in 3 months

issue closedpwoolcoc/elefren

Remove mention of fork.

I have archived mammut redirecting people to elefren. I would prefer you could remove the mention of the fork in the top level description in GitHub, and update other mentions to use the correct link https://github.com/XAMPPRocky/mammut

closed time in 3 months

XAMPPRocky

issue commentpwoolcoc/elefren

Remove mention of fork.

Thanks, this has been done

XAMPPRocky

comment created time in 3 months

push eventpwoolcoc/elefren

Paul Woolcock

commit sha 23a7fff57c066f8545cfe9cadb98e7cb6ae4ab9b

Update error type to remove deprecated `description` uses

view details

push time in 3 months

PR merged pwoolcoc/elefren

Use `slice::iter` instead of `into_iter` to avoid future breakage

an_array.into_iter() currently just works because of the autoref feature, which then calls <[T] as IntoIterator>::into_iter. But in the future, arrays will implement IntoIterator, too. In order to avoid problems in the future, the call is replaced by iter() which is shorter and more explicit.

A crater run showed that your crate is affected by a potential future change. See https://github.com/rust-lang/rust/pull/65819 for more information.

+1 -1

0 comment

1 changed file

Aaron1011

pr closed time in 3 months

push eventpwoolcoc/elefren

Aaron Hill

commit sha 7e3f25dab47269722e1551f77d830042b6b2730d

Use `slice::iter` instead of `into_iter` to avoid future breakage `an_array.into_iter()` currently just works because of the autoref feature, which then calls `<[T] as IntoIterator>::into_iter`. But in the future, arrays will implement `IntoIterator`, too. In order to avoid problems in the future, the call is replaced by `iter()` which is shorter and more explicit.

view details

push time in 3 months

push eventpwoolcoc/elefren

Jennifer Glauche

commit sha 1dd2963cf397958aa9e8cf483ce901f2b0ae8f7d

make MetadataFields be public

view details

Jennifer Glauche

commit sha ac3ecc82b76a2b91f5ffb5309bece02cef51d85f

add documentation to metadata fields

view details

push time in 3 months

PR merged pwoolcoc/elefren

Make fields of MetadataField exposed to public

I needed to access the Metadata Fields in my application and it wouldn't let me. While the struct was defined as public, the fields were not. I changed the fields to public.

+4 -2

0 comment

1 changed file

jglauche

pr closed time in 3 months

PR merged pwoolcoc/elefren

Make Scopes deserializable

this change implements serde::Deserialize for elefren::scopes::Scopes.

I need that to cache the "parts" from elefren::registration::Registered::into_parts() (btw I wish this method returned a struct deriving Serialize and Deserialize, rather than a tuple, but that'd be a breaking change).

+29 -1

0 comment

1 changed file

MightyPork

pr closed time in 3 months

push eventpwoolcoc/elefren

Ondřej Hruška

commit sha 3d0ecb9e41da8dd85937b45d87602f96e947acbb

Add content_type support to StatusBuilder

view details

push time in 3 months

more