GithubHelp home page GithubHelp logo

apress / practical-rust-web-projects Goto Github PK

View Code? Open in Web Editor NEW
56.0 6.0 25.0 8.09 MB

Source Code for 'Practical Rust Web Projects' by Shing Lyu

License: Other

PLpgSQL 4.18% Rust 68.91% Shell 1.63% HTML 13.98% CSS 0.78% JavaScript 10.42% SCSS 0.11%

practical-rust-web-projects's Introduction

Apress Source Code

This repository accompanies Practical Rust Web Projects by Shing Lyu (Apress, 2021).

Cover image

Download the files as a zip using the green button, or clone the repository to your machine using Git.

Releases

Release v1.0 corresponds to the code in the published book, without corrections or updates.

Contributions

See the file Contributing.md for more information on how you can contribute to this repository.

practical-rust-web-projects's People

Contributors

shinglyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

practical-rust-web-projects's Issues

socket2 lib not compiling

Hello, I was working through chapter 2 and wanted to check my work, and when I downloaded the project from GitHub.
I received this error, it seems to be low level in one of the dependancies.

Does anyone know how to fix it?

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> /Users/mycomputer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socket2-0.3.12/src/sockaddr.rs:176:9 | 176 | mem::transmute::<SocketAddrV4, sockaddr_in>(v4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: source type:SocketAddrV4(48 bits) = note: target type:sockaddr_in` (128 bits)

For more information about this error, try rustc --explain E0512.
error: could not compile socket2 (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

`

Chapter 6 NodeJS build error

Going through the WebAssembly+NodeJS exercises in the last chapter and ran into the following error when attempting to build the NodeJS project:

$ npm run build

> [email protected] build
> webpack --config webpack.config.js

node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
    at /Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9
    at /Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.7.0

After a bit of Googling, I ran across someone suggesting to run the following command:

$ export NODE_OPTIONS=--openssl-legacy-provider

Then run the build command again, and it should all compile.

$ npm run build

> [email protected] build
> webpack --config webpack.config.js

Hash: 1707689247fe60c788af
Version: webpack 4.42.0
Time: 67ms
Built at: 11/08/2022 7:50:56 PM
                           Asset       Size  Chunks                         Chunk Names
                  0.bootstrap.js   5.31 KiB       0  [emitted]
7e852f2346d8cc54b57a.module.wasm  296 bytes       0  [emitted] [immutable]
                    bootstrap.js     11 KiB    main  [emitted]              main
                      index.html  297 bytes          [emitted]
Entrypoint main = bootstrap.js
[../pkg/hello_wasm.js] 81 bytes {0} [built]
[../pkg/hello_wasm_bg.js] 784 bytes {0} [built]
[../pkg/hello_wasm_bg.wasm] 270 bytes {0} [built]
[./bootstrap.js] 279 bytes {main} [built]
[./index.js] 51 bytes {0} [built]
[./node_modules/webpack/buildin/harmony-module.js] (webpack)/buildin/harmony-module.js 573 bytes {0} [built]

Not exactly sure what would be the proper fix here but using --openssl-legacy-provider unblocked me.

problem with cats_limit function

error[E0308]: mismatched types
--> src/main.rs:35:16
|
35 | cats: cats_data,
| ^^^^^^^^^^ expected struct Vec, found enum Result
|
= note: expected struct Vec<_>
found enum Result<Vec<_>, diesel::result::Error>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.